// SOAPDIMEHTTPClient.h: interface for the WMSOAPDIMEHTTPClient class.
//
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 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.
//
//////////////////////////////////////////////////////////////////////
//
// WMSOAPDIMEHTTPClient class - an HTTP client for SOAP messaging.
// uses DIME packaging of SOAP message and any attachments,
// in accordance with Internet-Draft "WS-Attachments"
// (draft-nielsen-dime-soap-01 June 17, 2002).
// 
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_WMSOAPDIMEHTTPClient_H__365CA870_4F9C_11D4_9E6C_00105AABC815__INCLUDED_)
#define AFX_WMSOAPDIMEHTTPClient_H__365CA870_4F9C_11D4_9E6C_00105AABC815__INCLUDED_

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

#include <comdef.h>
#include "DIMEParser.h"
#include "DIMERequestSock.h"
interface Iwmsoapmsg2;

class WMSOAPDIMEHTTPClient  
{
public:

	WMSOAPDIMEHTTPClient();
	virtual ~WMSOAPDIMEHTTPClient();

	int GetHTTPStatus() { return m_nHTTPStatus; }
	const wstring& GetErrorMsg() { return m_wstrErrorMsg; }

	bool SendSOAPMessage(const string& strMethod,
                         const string& strSOAPAction,
						 const string& strHost,
						 int nPortNbr,
						 const string& strSvcURI,
						 const string& strUserAgent,
						 Iwmsoapmsg2 *pIwmsoapmsg,
						 bool bIsDIMERequest);
    bool IsSoapResponse() { return m_bIsSoapResponse; }

protected:

	bool SendRequestWithEntity( const string& strMethod,
                                const string& strSOAPAction,
						        const string& strHost,
						        int nPortNbr,
						        const string& strSvcURI,
						        const string& strUserAgent,
						        Iwmsoapmsg2 *pIwmsoapmsg,
						        bool bIsDIMERequest);
	bool SendRequestWithoutEntity(  const string& strMethod,
                                    const string& strSOAPAction,
						            const string& strHost,
						            int nPortNbr,
						            const string& strSvcURI,
						            const string& strUserAgent,
						            Iwmsoapmsg2 *pIwmsoapmsg);
    bool ProcessDIMEResponse(Iwmsoapmsg2 *pIwmsoapmsg);

	// request XML buffer
	string				m_strRequestXML;
	// HTTP Response status 
	int					m_nHTTPStatus;
	// error message
	wstring				m_wstrErrorMsg;
    // SOAP response?
    bool                m_bIsSoapResponse;
	// socket
	WMDIMERequestSock	m_Socket;
	// DIME parser
	DIMEParser			m_DIMEParser;
};

#endif // !defined(AFX_WMSOAPDIMEHTTPClient_H__365CA870_4F9C_11D4_9E6C_00105AABC815__INCLUDED_)
