This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am trying to send a SOAP Message from Java based on the encoding of the types in WSDL.
How do I find it in WSDL? Is the WSDL file's XML encoding type same as the encoding needed for its SOAP operations (I think there can be a case where the WSDL itself is in UTF-8 but one of its operation needs to be encoded as gb2312 while sending as a SOAP request).
Encoding of request and response messages are specified in the <binding> element of a WSDL. In that element you will be able to see <body> elements belonging to the namespace http://schemas.xmlsoap.org/wsdl/soap/ (for WSDL 1.1). The value of the use attribute specifies the encoding.
Note that the WS-I Basic Profile only allows for literal encoding!
If you want to enclose character data encoded using some other character encoding scheme in a web service request or response, then you may want to encode that data using, for instance, Base64 before sending it in a SOAP message and then decoding it, of course, once it arrives at its destination.
Joined: Jun 10, 2008
But "use=literal/encoded" just specifies whether xsi:type attribute is added to each element in the SOAP body or not.
I am talking about the encoding of the actual string content that goes inside the elements (utf-8, gb2312, iso-8859 etc).
Where to find and how to set the encoding of the content?
Joined: Oct 04, 2006
The character encoding of SOAP messages has to, as far as I understand, be UTF-8 or UTF-16 according to the WS-I Basic Profile 1.1:
http://www.ws-i.org/Profiles/BasicProfile-1.1.html#Acceptable_WSDL_Character_Encodings As I said in my earlier message, you can encode data enclosed in a SOAP request or response using, for instance, Base64, if you have character data encoded in some other fashion. Note that both clients and server have to be aware of such encoding.
Joined: Jun 10, 2008
I was thinking that there could be specific tags that need content in gb2312, iso etc.