my dog learned polymorphism*
The moose likes Web Services and the fly likes Where to find encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Where to find encoding" Watch "Where to find encoding" New topic
Author

Where to find encoding

ramesh agarwal
Greenhorn

Joined: Jun 10, 2008
Posts: 19
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).
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
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.
An example:

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.
Best wishes!
ramesh agarwal
Greenhorn

Joined: Jun 10, 2008
Posts: 19
ok. thanks.

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?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
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.
Best wishes!
ramesh agarwal
Greenhorn

Joined: Jun 10, 2008
Posts: 19
understood.

I was thinking that there could be specific tags that need content in gb2312, iso etc.

Thanks for the clarification.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where to find encoding
 
Similar Threads
weblogic rpc webservice
Object 2.1 List and describe the encoding types used in a SOAP message.
NullPointerException when calling a web service
Clarification sought on the Basic profile
document encoded