Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Where to find encoding

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
understood.

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

Thanks for the clarification.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic