[jboss-user] [JBossWS] - Web service response encoding

alanjonesbath do-not-reply at jboss.com
Tue Aug 29 09:11:46 EDT 2006


We've been having a few issues with the encoding of the response message being sent by our web service.

The request message being received by our web service is
<?xml version="1.0" encoding="UTF-8"?>
  | <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
  |  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  | xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://dummy.co.uk/systemname/consortium/V1.0">
  |   <env:Body>
  |     <ns0:TransactionStatusUpdate>
  |       <ns0:request>
  |         <ns0:TransactionId>0</ns0:TransactionId>
  |         <ns0:Status>0</ns0:Status>
  |         <ns0:Description>TEST</ns0:Description>
  |         <ns0:UTCTimestamp>2006-08-25T14:57:04.813+01:00</ns0:UTCTimestamp>
  |       </ns0:request>
  |     </ns0:TransactionStatusUpdate>
  |   </env:Body>
  | </env:Envelope>

The problem is in the response message, which is

  | 51
  | <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header/>
  | 108
  | <env:Body><ns1:TransactionStatusUpdateResponse xmlns:ns1='http://dummy.co.uk/systemname/consortium/V1.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  | <ns1:TransactionStatusUpdateResult><ns1:Accepted xmlns:ns1='http://dummy.co.uk/systemname/consortium/V1.0'>true
  | f
  | </ns1:Accepted>
  | 66
  | <ns1:UTCTimestamp xmlns:ns1='http://dummy.co.uk/systemname/consortium/V1.0'>2006-08-24T09:43:36.167+01:00
  | 13
  | </ns1:UTCTimestamp>
  | 24
  | </ns1:TransactionStatusUpdateResult>
  | 26
  | </ns1:TransactionStatusUpdateResponse>
  | b
  | </env:Body>
  | f
  | </env:Envelope>
  | 0
Obviously, that doesn't look quite right. Can anybody explain why all these extra numbers are appearing (seamingly randomly) in the output, and also why the output doesn't have the <?xml version="1.0" encoding="UTF-8"?> header tag in it?

We've been using the MSSoapT tool to 'listen' to the request and response messages, but using the .NET WebService Studio tool (we are only using Java/JBoss, but the company developing the webservice we're responding to/calling our web service are using .NET hence why we're using these tools) we view a somewhat different version of the respose message:
ResponseCode: 200 (OK)
  | Server:Apache-Coyote/1.1
  | X-Powered-By:Servlet 2.4; JBoss-4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)/Tomcat-5.5
  | Set-Cookie:JSESSIONID=716880964EAF840A9F18C5C17E7B5B7A; Path=/
  | Content-Type:text/xml;charset=UTF-8
  | Transfer-Encoding:chunked
  | Date:Fri, 25 Aug 2006 13:03:41 GMT
  | 
  | <?xml version="1.0" encoding="utf-16"?>
  | <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  |   <env:Header />
  |   <env:Body>
  |     <ns1:TransactionStatusUpdateResponse xmlns:ns1="http://dummy.co.uk/systemname/consortium/V1.0"
  |  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  |       <ns1:TransactionStatusUpdateResult>
  |         <ns1:Accepted xmlns:ns1="http://dummy.co.uk/systemname/consortium/V1.0">true</ns1:Accepted>
  |         <ns1:UTCTimestamp xmlns:ns1="http://dummy.co.uk/systemname/consortium/V1.0">2006-08-25T14:03:41.533+01:00</ns1:UTCTimestamp>
  |       </ns1:TransactionStatusUpdateResult>
  |     </ns1:TransactionStatusUpdateResponse>
  |   </env:Body>
  | </env:Envelope>
Now, this seems to suggest that we're using UTF-16 for the encoding, which we're not! As far as I'm aware, all the defaults are UTF-8, and just to be totally sure, when I run the JBoss server we are using the "-Dfile.encoding=utf-8" option, and when we compile our web service and test client we using the "-encoding utf-8". None of our config xml files mention utf-16 anywhere, so I really don't know why the response appears to be encoded in utf-16.

If anyone can give me any explanation as to why
a) Why we are getting these random numbers appearing in the output
b) Why it appears to be using utf-16 encoding
...I'd be very appreciative, as I've been pulling my hair out on this one for a few days now. If you need any other information like the WSDL etc. then just say and I'll post it.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968063#3968063

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968063



More information about the jboss-user mailing list