You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Sudhin Bengeri <sb...@opnet.com> on 2004/03/25 00:20:39 UTC
Axis C++ client program aborts when response HTTP has
"Transfer-Encoding: chunked"
Hi,
I have implemented a simple Axis C++ client that communicates with a web
service written in Java (Axis Java 1.1). Using TCPMonitor I found out that
the web service uses "chunked" transfer encoding which the Axis C++ client
is unable to parse and program aborts. The program abort occurs in function
SoapParserExpat::ParseNext(), when it calls the "XML_Parse (...)" function.
I have include the HTTP response below:
HTTP/1.1 200 OK
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Wed, 24 Mar 2004 18:25:07 GMT
Server: Apache-Coyote/1.1
216
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:serviceMethodResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://wtn12038:1234/axis/services/MyService">
<ns1:serviceMethodReturn
xsi:type="xsd:string">Sudhin</ns1:serviceMethodReturn>
</ns1:serviceMethodResponse>
</soapenv:Body>
</soapenv:Envelope>
0
Note the "216" before the start of the SOAP envelope and the "0" after the
envelope. Is the Axis C++ team thinking of supporting this format feature?
Thanks,
- Sudhin.
--
Sudhindra S. Bengeri
Modeling Engineer
OPNET Technologies Inc.,
(240) 497-3000 x2414
====================================================
Register for OPNET's Online Technology Workshops
http//www.opnet.com/TechWorkshops/
====================================================
Register for OPNETWORK 2004 (Aug 30 - Sept 3, Washington DC)
http://www.opnet.com/opnetwork2004/
====================================================
"Transfer-Encoding: chunked" and Whiteapcase Problems: Patch
Posted by Samisa Abeysinghe <sa...@yahoo.com>.
Hi,
Here is a quick patch for the problems.
I assume that numbers in chunk message in HTTP 1.1 has no impact on XML payload and simply
ignore them.
Also I rip off white spaces to solve Xerces paser failing to deserialize messages with spaces
within thags.
Add this patch for the time being (so that r 1.1 would be able to interoperate with Axis Java)
Please fix the problem by improving the SoapDeserializer when somebody have enough time to study
the problem in detail.
The patch
--------------------------------------------------------------------------------------------------
diff -u cpp/original/src/transport/axis/HttpTransport.cpp
cpp/ws-axis/c/src/transport/axis/HttpTransport.cpp
--- cpp/original/src/transport/axis/HttpTransport.cpp 2004-04-09 08:43:45.000000000 +0600
+++ cpp/ws-axis/c/src/transport/axis/HttpTransport.cpp 2004-04-08 17:09:56.000000000 +0600
@@ -465,8 +465,26 @@
//{
//m_bStatus = false; // we have the payload
// Extract the SOAP message
- //m_PayLoad = m_PayLoad.substr(m_PayLoad.find('<'));
- //m_PayLoad = m_PayLoad.substr(0, m_PayLoad.rfind('>') + 1);
+ //samisa
+ m_PayLoad = m_PayLoad.substr(m_PayLoad.find('<'));
+ m_PayLoad = m_PayLoad.substr(0, m_PayLoad.rfind('>') + 1);
+ for( int i = 0; i <= m_PayLoad.size(); i++)
+ {
+ //remove whitespaces except ' '
+ if( m_PayLoad[i] == '\n' || m_PayLoad[i] == '\r' || m_PayLoad[i]
== '\t' )
+ m_PayLoad.erase(i--, 1);
+
+ //remove spaces within two different tags
+ if( m_PayLoad[i] == '>' )
+ {
+ int j = i+1;
+ while( isspace(m_PayLoad[j] )) j++;
+ m_PayLoad.erase(i+1, j-(i+1));
+ }
+
+ }
+ printf( "%s\n", m_PayLoad.c_str() );
+ //samisa
//}
//}
----------------------------------------------------------------------------------------------
Thanks,
Samisa...
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/
Re: Axis C++ client program aborts when response HTTP has "Transfer-Encoding: chunked"
Posted by Samisa Abeysinghe <sa...@yahoo.com>.
Hi,
I experianced the same problem and I modified the HttpTransport code to ignore the numbers. (assuming they have no impact in the XML payload) Then I could successfully access the Calculator.jws (userguide/example2) of Axis Java.
(Please refer to the patch I sent for white space stripping)
Thanks,
Samisa....
Paul Fremantle <pz...@hursley.ibm.com> wrote:
Folks
We have seen the same behaviour talking to another HTTP 1.1 server. Is
there a fix for this? Or a way of switching back to HTTP 1.0 to bypass this?
Paul
Sudhin Bengeri wrote:
> Hi,
>
> I have implemented a simple Axis C++ client that communicates with a
> web service written in Java (Axis Java 1.1). Using TCPMonitor I found
> out that the web service uses "chunked" transfer encoding which the
> Axis C++ client is unable to parse and program aborts. The program
> abort occurs in function SoapParserExpat::ParseNext(), when it calls
> the "XML_Parse (...)" function. I have include the HTTP response below:
>
> HTTP/1.1 200 OK
> Content-Type: text/xml;charset=utf-8
> Transfer-Encoding: chunked
> Date: Wed, 24 Mar 2004 18:25:07 GMT
> Server: Apache-Coyote/1.1
>
> 216
>
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
> xmlns:ns1="http://wtn12038:1234/axis/services/MyService">
> > xsi:type="xsd:string">Sudhin
>
>
>
> 0
>
> Note the "216" before the start of the SOAP envelope and the "0" after
> the envelope. Is the Axis C++ team thinking of supporting this format
> feature?
>
> Thanks,
> - Sudhin.
>
>
> --
> Sudhindra S. Bengeri
> Modeling Engineer
> OPNET Technologies Inc.,
> (240) 497-3000 x2414
>
> ====================================================
> Register for OPNET's Online Technology Workshops
> http//www.opnet.com/TechWorkshops/
> ====================================================
> Register for OPNETWORK 2004 (Aug 30 - Sept 3, Washington DC)
> http://www.opnet.com/opnetwork2004/
> ====================================================
>
>
---------------------------------
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway - Enter today
Re: Axis C++ client program aborts when response HTTP has "Transfer-Encoding:
chunked"
Posted by Paul Fremantle <pz...@hursley.ibm.com>.
Folks
We have seen the same behaviour talking to another HTTP 1.1 server. Is
there a fix for this? Or a way of switching back to HTTP 1.0 to bypass this?
Paul
Sudhin Bengeri wrote:
> Hi,
>
> I have implemented a simple Axis C++ client that communicates with a
> web service written in Java (Axis Java 1.1). Using TCPMonitor I found
> out that the web service uses "chunked" transfer encoding which the
> Axis C++ client is unable to parse and program aborts. The program
> abort occurs in function SoapParserExpat::ParseNext(), when it calls
> the "XML_Parse (...)" function. I have include the HTTP response below:
>
> HTTP/1.1 200 OK
> Content-Type: text/xml;charset=utf-8
> Transfer-Encoding: chunked
> Date: Wed, 24 Mar 2004 18:25:07 GMT
> Server: Apache-Coyote/1.1
>
> 216
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <ns1:serviceMethodResponse
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
> xmlns:ns1="http://wtn12038:1234/axis/services/MyService">
> <ns1:serviceMethodReturn
> xsi:type="xsd:string">Sudhin</ns1:serviceMethodReturn>
> </ns1:serviceMethodResponse>
> </soapenv:Body>
> </soapenv:Envelope>
> 0
>
> Note the "216" before the start of the SOAP envelope and the "0" after
> the envelope. Is the Axis C++ team thinking of supporting this format
> feature?
>
> Thanks,
> - Sudhin.
>
>
> --
> Sudhindra S. Bengeri
> Modeling Engineer
> OPNET Technologies Inc.,
> (240) 497-3000 x2414
>
> ====================================================
> Register for OPNET's Online Technology Workshops
> http//www.opnet.com/TechWorkshops/
> ====================================================
> Register for OPNETWORK 2004 (Aug 30 - Sept 3, Washington DC)
> http://www.opnet.com/opnetwork2004/
> ====================================================
>
>
Re: Axis C++ client program aborts when response HTTP has "Transfer-Encoding:
chunked"
Posted by Paul Fremantle <pz...@hursley.ibm.com>.
Folks
We have seen the same behaviour talking to another HTTP 1.1 server. Is
there a fix for this? Or a way of switching back to HTTP 1.0 to bypass this?
Paul
Sudhin Bengeri wrote:
> Hi,
>
> I have implemented a simple Axis C++ client that communicates with a
> web service written in Java (Axis Java 1.1). Using TCPMonitor I found
> out that the web service uses "chunked" transfer encoding which the
> Axis C++ client is unable to parse and program aborts. The program
> abort occurs in function SoapParserExpat::ParseNext(), when it calls
> the "XML_Parse (...)" function. I have include the HTTP response below:
>
> HTTP/1.1 200 OK
> Content-Type: text/xml;charset=utf-8
> Transfer-Encoding: chunked
> Date: Wed, 24 Mar 2004 18:25:07 GMT
> Server: Apache-Coyote/1.1
>
> 216
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <ns1:serviceMethodResponse
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
> xmlns:ns1="http://wtn12038:1234/axis/services/MyService">
> <ns1:serviceMethodReturn
> xsi:type="xsd:string">Sudhin</ns1:serviceMethodReturn>
> </ns1:serviceMethodResponse>
> </soapenv:Body>
> </soapenv:Envelope>
> 0
>
> Note the "216" before the start of the SOAP envelope and the "0" after
> the envelope. Is the Axis C++ team thinking of supporting this format
> feature?
>
> Thanks,
> - Sudhin.
>
>
> --
> Sudhindra S. Bengeri
> Modeling Engineer
> OPNET Technologies Inc.,
> (240) 497-3000 x2414
>
> ====================================================
> Register for OPNET's Online Technology Workshops
> http//www.opnet.com/TechWorkshops/
> ====================================================
> Register for OPNETWORK 2004 (Aug 30 - Sept 3, Washington DC)
> http://www.opnet.com/opnetwork2004/
> ====================================================
>
>