// interopsvcdocObj.h : Declaration of the CinteropsvcdocObj

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

#include "interopsvcdoc.h"

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

class WMXMLElement;

// CinteropsvcdocObj

class ATL_NO_VTABLE CinteropsvcdocObj : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CinteropsvcdocObj, &CLSID_interopsvcdoc2>,
	public IDispatchImpl<Iinteropsvcdoc2, &IID_Iinteropsvcdoc2, &LIBID_interopsvcdocLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
	CinteropsvcdocObj()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_INTEROPSVCDOCOBJ)


BEGIN_COM_MAP(CinteropsvcdocObj)
	COM_INTERFACE_ENTRY(Iinteropsvcdoc2)
	COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()


	DECLARE_PROTECT_FINAL_CONSTRUCT()

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

public:
	STDMETHOD(OnProcessBody)(/*[in]*/ VARIANT SOAPMsgInterface, /*[out, retval]*/ VARIANT_BOOL *pResult);
protected:
	bool GenerateFault(Iwmsoapmsg2 *pIwmsoapmsg);
	bool ProcessMessage(Iwmsoapmsg2 *pIwmsoapmsg);

	bool	m_bSingleTagFound;
	bool	m_bSimpleDocFound;
	bool	m_bComplexDocFound;
	wstring	m_wstrSingleTagValue;
	wstring	m_wstrSimpleDocValue;
	WMXMLElement *m_pComplexDocElem;
};

OBJECT_ENTRY_AUTO(__uuidof(interopsvcdoc2), CinteropsvcdocObj)
