File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Extrange codes in the response from axis Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Extrange codes in the response from axis" Watch "Extrange codes in the response from axis" New topic

Extrange codes in the response from axis

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi all, i'm sending a request for a services to my axis module. This is the message i send:
POST /axis/services HTTP/1.1
SOAPAction: OfertaServicio#seleccionar
Content-Type: text/xml
Content-Length: 528
User-Agent: kSOAP/1.0
Host: localhost
<SOAP-ENV:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:SOAP-ENC="" xmlns:SOAP-ENV="">
<SOAP-ENV:Body SOAP-ENV:encodingStyle="">
<seleccionar xmlns="OfertaServicio" id="o0" SOAP-ENC:root="1">
<nombreServicio xmlns="" xsi:type="xsd:string">servicio1</nombreServicio>
as you can say, i use ksoap from a MIDLET to send my message. The problem is that the response i get from axis contains 'extrange characters' (I think this term is not correct) causing my parser to rise a ParseException (I'm using kxml). This is the response:
HTTP/1.1 200 OK
Date: Tue, 25 Mar 2003 13:28:20 GMT
Server: WebLogic WebLogic Server 6.1 SP4 11/08/2002 21:50:43 #221641
Content-Type: text/xml; charset=utf-8
Transfer-Encoding: Chunked
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">
<ns1:seleccionarResponse soapenv:encodingStyle="" xmlns:ns1="OfertaServicio">
<seleccionarReturn xsi:type="xsd:string">Hola majete, tu mensaje: servicio1</seleccionarReturn>

Why axis put the '0204' and '0000' at the begining and the end of the mesagge? Is it related with the Transfer Encoding: Chunked?
Any idea is welcome.
Thank in advance.
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
"Chunked" Transfer Coding is basically another way to tell the client "how much stuff I intended to send".
When serving a static file, the web server can use the Content-Length HTTP header to say "I'm sending out 2142 bytes, hope you get it all". When the content is generated dynamically, the server would either need to load the whole data into memory, measure the length, and then send it to the client, OR use another scheme, which is the Chunked Transfer Coding.
In the Chunked Transfer Coding, there is the length of the following chunk before the chunk itself. See chapter 3.6.1 of the HTTP 1.1 RFC at for details.
[ March 25, 2003: Message edited by: Lasse Koskela ]

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
As far as i could read, the codes come from the chunked transfer encoding. Now this is right, but how can I read these mesagges from my MIDLET? And why the KSOAP-MIDLET fails but not the one for Standar Edition?
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Have you checked the kSOAP mailing lists at There used to be something about a HttpTransport class not being included or a wrong version was included in the distribution archive, which caused the server to use chunked encoding (or something like that).
I agree. Here's the link:
subject: Extrange codes in the response from axis
It's not a secret anymore!