// SOAPAutomationStub.h: interface for the WMSOAPAutomationStub class.
//
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001 Robert Cunnings. All rights reserved.
//
// You may copy, modify, distribute or publish this code free of charge.
//
// NO WARRANTY: This software is provided AS IS, without warranty of any kind.
//
//////////////////////////////////////////////////////////////////////
//
// WMSOAPAutomationStub class - a dispatcher for COM service providers.
// 
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_WMSOAPAUTOMATIONSTUB_H__78204501_4AB3_11D4_9E6B_00105AABC815__INCLUDED_)
#define AFX_WMSOAPAUTOMATIONSTUB_H__78204501_4AB3_11D4_9E6B_00105AABC815__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

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

#define MAX_SOAP_PARAMS 32

class WMSOAPProcessor;
class WMMessageHandler;
class WMSOAPWSDLClient;
class WMSOAPMessage;

class WMSOAPAutomationStub  
{
public:
	WMSOAPAutomationStub();
	virtual ~WMSOAPAutomationStub();

	bool InvokeMethod(const wstring& wstrProgID, Iwmsoapmsg2 *pIwmsoapmsg);

private:
	bool InvokeSOAPMethod(const wstring& wstrProgID, Iwmsoapmsg2 *pIwmsoapmsg);

	// dispatch method invocation support
	_variant_t	        m_varRetVal;
	DISPPARAMS	        m_DispatchParams;
	DISPID		        m_idDispatchIDs[MAX_SOAP_PARAMS];
	_variant_t	        m_varParamValues[MAX_SOAP_PARAMS];
    _variant_t          m_varByRefParams[MAX_SOAP_PARAMS];
	BSTR		        m_bstrNames[MAX_SOAP_PARAMS];
	// [out] parameter map
	map<int, wstring>	m_mapOutParamOffsets;
	// IDispatch ptr
	IDispatch	        *m_pIDispatch;
};

#endif // !defined(AFX_WMSOAPAUTOMATIONSTUB_H__78204501_4AB3_11D4_9E6B_00105AABC815__INCLUDED_)
