View Full Version : Error on QtSoapMessage::toXmlString

27th October 2009, 10:51
I have create qtsoap message and got error once submit to
dotnet. Then I have verified to see all message and found
problem at 2 points.

1. Once create QdomDocument and convert to string at line
doc.toString(). I got correct of xml syntax as :-

Correct Syntax: <tag> xx </tag>
Please see Result of xmlRequest Message section below.

But got incorrect syntax after convert to qtsoapmessage as:-

Incorrect Syntax: &lt;tag> xx &lt;/tag>
Please see Result of requestMessage section below.

2. At "Control xmlns=''", I need to get xmlns='' at starting
tag but need to eliminate xmlns='' from ending tag.

Correct Syntax: <Control xmlns=''>
<tag> xx </tag>

Please see Result of requestMessage section below.

If I did not eliminate xmlns='' at ending tag. I will got an
error once submit to dotnet.

Please help and thanks in advance.

//Some part of program...!

QDomDocument doc("");

QDomElement sub01 = doc.createElement("Control xmlns=''");

// TransactionType
QDomElement tag01 = doc.createElement("TT");
QDomText _tag01 = doc.createTextNode("100");

// TransactionReverse
QDomElement tag02 = doc.createElement("TR");
QDomText _tag02 = doc.createTextNode("O01");

// TransactionEvent
QDomElement tag03 = doc.createElement("TE");
QDomText _tag03 = doc.createTextNode("ACK");

// I then get the QString...
QString xmlRequest = doc.toString(); //
qDebug() << xmlRequest; // Please see Result of xmlRequest

// Then build the soap message as follows:
QtSoapMessage request;
request.setMethod("Post", "http://SomeURL.com/SUB/SUB1");
request.addMethodArgument("SUB_Request", "", xmlRequest);

QString requestMessage = request.toXmlString(); // Line 2
qDebug() << requestMessage; // Please see Result of requestMessage

//and so on posting this to the web service URL..

http.setHost("SomeURL.com", 443);
http.submitRequest(request, "/sub_url/req.asmx?wsdl");

Result of xmlRequest Message......!

<Control xmlns=''>
</Control xmlns=''> // need to eliminate xmlns='' out from this tag

End of xmlRequest Message........!

Result of requestMessage .....!

NEED TO GET CORRECT SYNTAX from &lt;tag>xx&lt;/tag> => <tag> xx </tag>

<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/2001/XMLSchema" >
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<Post xmlns="http://SomeURL.com/SUB/SUB1">
&lt;Control xmlns=''>
&lt;/Control xmlns=''>

End of requestMessage ......!:confused: