Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SOAP and C++

Status
Not open for further replies.

B00gyeMan

Programmer
Jan 14, 2004
259
RO
Hi. I would need a tutorial on how to write a client for an Apache SOAP server application. I am interested in both managed & unmanaged C++.
Thanks.
 
you need to install MSSOAP SDK and there is a good help.

Ion Filipski
1c.bmp
 
This is the code:

ISoapConnectorPtr Connector;
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
Reader.CreateInstance(_uuidof(SoapReader));
hr=Serializer.CreateInstance(_uuidof(SoapSerializer));
hr=Connector.CreateInstance(__uuidof(HttpConnector));
//* INIT
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream),"");
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
Connector->Property["EndPointURL"]=szSOAPEndPointURL;
Connector->Connect();

Connector->BeginMessage();
Serializer->startEnvelope("","NONE","");
Serializer->startBody("STANDARD");
Serializer->SoapAttribute("","urn:Something","NS1","NS1");
Serializer->startElement("xmlinput","","NONE","");
Serializer->writeString(szRequest);
Serializer->endElement();
Serializer->endElement();
Serializer->startElement("xmloutput","","NONE","");
Serializer->endElement();
Serializer->endBody();
Serializer->endEnvelope();

Connector->EndMessage();
MessageBox(Reader->RPCResult->text);

The result is:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlns:SOAP-ENV=" SOAP-ENV:encodingStyle=" xmlns:NS1="urn:Something" NS1:="NS1"><xmlin>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;request xmlns:xsi=&quot; xsi:noNamespaceSchemaLocation=&quot;PerformAction.xsd&quot;&gt; &lt;a param=&quot;random&quot;/&gt; &lt;another param=&quot;value1&quot; yet another=&quot;value2&quot;/&gt;&lt;/request&gt;</xmlin></NS1:performAction><xmlout/></SOAP-ENV:Body></SOAP-ENV:Envelope>

The Apache SOAP server throws an exception:
org.xml.sax.SAXParseException: An invalid second ':' was found in the element ty
pe or attribute name.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213
)

What am I missing here? (It is my first SOAP client ever, so don't be so harsh :) ).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top