// WMSOAPRespDeserializer.h: interface for the WMSOAPRespDeserializer class.
//
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 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.
//
//////////////////////////////////////////////////////////////////////
//
// WMSOAPRespDeserializer class - a SOAP message deserializer.
// Populates WMSOAPMessage object with binary representation of message.
// Both "encoded" (SOAP encoding only) or "literal" usage supported.
// 
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_WMSOAPRESPDESERIALIZER_H__A9FC82A7_8AA8_4FFA_92AB_38EE2411D7E9__INCLUDED_)
#define AFX_WMSOAPRESPDESERIALIZER_H__A9FC82A7_8AA8_4FFA_92AB_38EE2411D7E9__INCLUDED_

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

#include <comdef.h>
#include "SOAPEventHandler.h"
#include "WMSOAPDeserializer.h"

class WMSOAPRespDeserializer : public WMSOAPDeserializer
{
public:
	WMSOAPRespDeserializer();
	virtual ~WMSOAPRespDeserializer();

	bool Deserialize(WMSOAPMessage& Msg, Iwmwsdlclient2 *pIWSDLClient);
	bool ProcessRPCResponseEnc(WMSOAPMessage& Msg, Iwmwsdlclient2 *pIWSDLClient);
	bool ProcessRPCResponseLit(WMSOAPMessage& Msg, Iwmwsdlclient2 *pIWSDLClient);

	bool IsSOAPFault();

    WMSOAPEnvelopeHandler<WMSOAPHeaderHandler, WMSOAPResponseBodyHandler>& GetEnvelopeHandler();
	WMSOAPHeaderHandler& GetHeaderHandler();
	WMSOAPResponseBodyHandler& GetBodyHandler();

protected:
	bool DeserializeHeader(	WMSOAPMessage& Msg,	Iwmwsdlclient2 *pIWSDLClient);
	bool DeserializeBody(WMSOAPMessage& Msg, Iwmwsdlclient2 *pIWSDLClient);
	bool DeserializeSOAPFault(WMSOAPMessage& Msg, Iwmwsdlclient2 *pIWSDLClient);

	const vector<WMSOAPHeaderElemHandler *>& GetHeaderEntries();
	WMSOAPResponseHandler *GetResponseHandler();
	const vector<WMSOAPParamHandler *>& GetMethodParameters();
	WMSOAPParamHandler *GetMultiRefElem(WMSOAPParamHandler *pParam);
	// the top-level SOAP event handler
	WMSOAPMessageHandler< WMSOAPEnvelopeHandler
			<WMSOAPHeaderHandler, WMSOAPResponseBodyHandler> > m_MsgHandler;
};

#endif // !defined(AFX_WMSOAPRESPDESERIALIZER_H__A9FC82A7_8AA8_4FFA_92AB_38EE2411D7E9__INCLUDED_)
