Using an Apache Axis web service from C++ client
-
I need to send an XML document to a web service running Apache Axis. I have been attempting to POST it using XMLHTTP:
HRESULT hr = CoInitialize(NULL); ... IServerXMLHTTPRequestPtr pXMLHTTPReq = NULL; hr = pXMLHTTPReq.CreateInstance(__uuidof(ServerXMLHTTP40)); hr = pXMLHTTPReq->open( _bstr_t("POST"), bstrURL, _variant_t(VARIANT_FALSE) ); CComBSTR xmlString; m_spXMLDoc->get_xml( &xmlString ); // m_spXMLDoc already loaded with XML hr = pXMLHTTPReq->setRequestHeader(_bstr_t("Content-Type"), _bstr_t("text/xml; charset=utf-8")); hr = pXMLHTTPReq->setRequestHeader(_bstr_t("SOAPAction"), _bstr_t("")); hr = pXMLHTTPReq->send( (_variant_t)xmlString ); long status = pXMLHTTPReq->Getstatus(); _bstr_t bstrResponse = pXMLHTTPReq->GetresponseText(); ...
Before I added the line:hr = pXMLHTTPReq->setRequestHeader(_bstr_t("SOAPAction"), _bstr_t(""));
I was connecting but getting a No Soap Action error. But having added ths line when execution tries to run at that line it raises an exception. I would appreciate any advice anyone can give me on how I can POSt xml through to an Apache Axis web service successfully.