WebService SOAP messages are interactive in XML format, where the delivery of special characters cannot be resolved, resulting in data processing failure.
The solution is as follows:
1, before sending the message, the Base64 transcoding for the message, after escaping to avoid the message contains special characters.
The standard base64 is preceded by%, and if stored in a database and queried in sql, it resolves to a wildcard character, which results in an error.
After the search using the improved version of Base64 transcoding, you can circumvent the problem, specific degree Niang.
The disadvantage of this approach is that all clients need to know how to decode, otherwise they cannot resolve.
2. In XML, use CDATA to tag special characters, which is not very good after analysis.
The current shortcomings have 2, one is required for each special character are converted, first of all I do not know what should be used to add <! [cdata[]]> is the time when the property value is set, or when the message is last generated;
And using this, the data cannot contain [[]] characters. If you know how to solve this problem, please advise. I am also just a web-learning.
3, still have to study what object of, did not study very much, please everybody discuss what mean:
The XML string is returned to the client through an XML Document object, and the XmlDocument cannot be returned directly to the client because the XML document object in Java cannot be interpreted correctly, and we can only return an XML string:
Public String Getallnewspace () {
Document document = Documenthelper.createdocument ();
Element root=document.addelement ("root");
..............................
if (null! = DataSet) {
while (Dataset.next ()) {
Element user=root.addelement ("user");
Element username=user.addelement ("UserName");
Username.settext (dataset.getstring (1));
Element userid=user.addelement ("UserId");
Userid.settext (dataset.getstring (2));
}
}
return Document.asxml ();
}