6 Replies Latest reply on Sep 19, 2006 4:07 AM by alan Jones

    Web service response encoding

    alan Jones Newbie

      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:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://dummy.co.uk/systemname/consortium/V1.0">

      The problem is in the response message, which is
      <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:UTCTimestamp xmlns:ns1='http://dummy.co.uk/systemname/consortium/V1.0'>2006-08-24T09:43:36.167+01:00

      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)
      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=/
      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 />
       <ns1:TransactionStatusUpdateResponse xmlns:ns1="http://dummy.co.uk/systemname/consortium/V1.0"
       <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>

      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.