Hi
I am attempting to use qtsoap to talk to a MFC SOAP service...
The lack of WSDL support is a pain (anyone know what happened to http://www.clausmark.com/feast_en.phtml?), so I am packet sniffing a working client to see what I should be sending.
To create the soap message I am building a DOM document, and then using request.setContent(xmlDocument) to add the document to the SOAP message.
This works fine with a simple request like:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<MyProc xmlns="http://tempuri.org/">
<Index>0</Index>
<Duration>0</Duration>
<MediaId>test</MediaId>
</MyProc >
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<MyProc xmlns="http://tempuri.org/">
<Index>0</Index>
<Duration>0</Duration>
<MediaId>test</MediaId>
</MyProc >
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
To copy to clipboard, switch view to plain text mode
But I have run into difficulty with a more complicated example.
When I packet sniff the data, the test client uses a namespace in the middle of the XML, however, the "Configuration" element itself doesn't have a prefix:
<InitialiseMyStuff xmlns="http://tempuri.org/">
<Index>0</Index>
<Configuration xmlns:a="http://schemas.datacontract.org/2004/07/MyTest.MyTestApp" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:TestA>0</a:TestA>
<a:TestB>1</a:TestB>
<a:TestC>2</a:TestC>
<InitialiseMyStuff xmlns="http://tempuri.org/">
<Index>0</Index>
<Configuration xmlns:a="http://schemas.datacontract.org/2004/07/MyTest.MyTestApp" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:TestA>0</a:TestA>
<a:TestB>1</a:TestB>
<a:TestC>2</a:TestC>
To copy to clipboard, switch view to plain text mode
I can't work out how to create the "Configuration" element as above,
xmlDocument.createElementNS("http://schemas.datacontract.org/2004/07/MyTest.MyTestAppt", "a:Configuration") gives me:
<a:Configuration xmlns:a="http://schemas.datacontract.org/2004/07/MyTest.MyTestApp">
<a:Configuration xmlns:a="http://schemas.datacontract.org/2004/07/MyTest.MyTestApp">
To copy to clipboard, switch view to plain text mode
And when I try this with setContent, the a: are stripped from the child nodes.
Any ideas?
Bookmarks