PDA

View Full Version : Extraneous characters in response



philippeback
Dec 12th, 2006, 03:11 AM
Hi,

I have a class like (well this is the parent):

public abstract class AbstractMessageHeaderEndpoint extends TransformerObjectSupport implements MessageEndpoint

To give back the answer we do:

String resultingXml = handleMessage(messageID, request.getPayloadSource());
StringReader sr = new StringReader(resultingXml);
getTransformer().transform(new StreamSource(sr), response.getPayloadResult());

So, the reponse gets populated and everything goes out.

The problem is that the response is:

TTP/1.1 200 OK
Date: Tue, 12 Dec 2006 08:45:40 GMT
Transfer-Encoding: chunked
Content-Type: text/xml; charset="utf-8"
X-Powered-By: Servlet/2.4 JSP/2.0

0097
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soapenv:Body>data</soapenv:Body></soapenv:Envelope>
0000

What are these 0097 and 0000 that are around the soap envelope ?
Our Webservices clients (based on JWSDP1.6 and Axis1.3) choke on that and fail.

TIA for any clue.
/Phil

Arjen Poutsma
Dec 13th, 2006, 03:34 AM
It looks like these are garbage unicode characters, which should not be there, of course. I have no idea how you can get rid of them, unfortunately. The only thing I can think of is to upgrade your Xerces and Xalan to recent versions.

It can be useful to use a different SOAP client (soapui (http://www.soapui.org)) for instance, to see whether you get this response there as well.

If you create a JIRA issue out of it, I will try to take a look at it later. Make sure you add all environment information (i.e. JDK version, app server, using SAAJ or Axiom, etc.)

philippeback
Dec 13th, 2006, 05:35 PM
I've found why there are these characters.
Since the reply is sent in chunked mode, theses XXXXes are delimiting the chunks. 0000 marks the end.

My JWSDP 1.6 client and my axis 1.3 clients are swallowing the output properly.

I've found my other issue and it had to do with a missing namespace to be provided in my reply. Our former WS implementation used Axis and took care of converting the WSDL in a compilant API whereas with SpringWS we have to go to the metal and call the Transformers ourselves. So, it appears that SpringWS is clean and flexible and requires a more understanding of what is going on under the cover.

Thanks for the reply.

Arjen Poutsma
Dec 15th, 2006, 07:00 AM
Yeah, I just remembered that it could have been the chunked mode as well. Great that you found out yourself, though.