// soap12testsvcdocObj.h : Declaration of the Csoap12testsvcdocObj

#pragma once
#include "resource.h"       // main symbols

#include "soap12testsvcdoc.h"
#include <string>
using namespace std;

interface Iwmsoapmsg2;

// Csoap12testsvcdocObj

class ATL_NO_VTABLE Csoap12testsvcdocObj : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<Csoap12testsvcdocObj, &CLSID_soap12testsvcdoc>,
	public IDispatchImpl<Isoap12testsvcdoc, &IID_Isoap12testsvcdoc, &LIBID_soap12testsvcdocLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
	Csoap12testsvcdocObj()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_SOAP12TESTSVCDOCOBJ)


BEGIN_COM_MAP(Csoap12testsvcdocObj)
	COM_INTERFACE_ENTRY(Isoap12testsvcdoc)
	COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()


	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}
	
	void FinalRelease() 
	{
	}

public:
	STDMETHOD(OnProcessSoapPost)(/*[in]*/ VARIANT SOAPMsgInterface, /*[in]*/ BSTR bstrSvcURI, /*[in]*/ BSTR bstrExtraPath, /*[out, retval]*/ VARIANT_BOOL *pResult);
	STDMETHOD(OnProcessSoapGet)(/*[in]*/ VARIANT SOAPMsgInterface, /*[in]*/ BSTR bstrSvcURI, /*[in]*/ BSTR bstrExtraPath, /*[in]*/ BSTR bstrQueryString, /*[out, retval]*/ VARIANT_BOOL *pResult);

protected:
	bool GenerateSenderFault(Iwmsoapmsg2 *pIwmsoapmsg, const wstring& wstrMsg);
	bool GenerateReceiverFault(Iwmsoapmsg2 *pIwmsoapmsg, const wstring& wstrMsg);
    bool GenerateDataEncUnkFault(Iwmsoapmsg2 *pIwmsoapmsg, const wstring& wstrMsg);
	bool ProcessPostMessage(Iwmsoapmsg2 *pIwmsoapmsg);
	bool ProcessGetMessage(Iwmsoapmsg2 *pIwmsoapmsg);

    // request URI components
    wstring     m_wstrSvcURI;
    wstring     m_wstrExtraPath;
    wstring     m_wstrQueryString;

    bool        m_bEchoOkFound;
    bool        m_bEchoSenderFault;
    bool        m_bEchoReceiverFault;
    bool        m_bBadEncoding;
    wstring     m_wstrEchoOk;

};

OBJECT_ENTRY_AUTO(__uuidof(soap12testsvcdoc), Csoap12testsvcdocObj)
