문제

I'm having issues accessing a web service provided by a third party. Looking at the Axis2 wire trace I can see \r\n3ff8\r\n in the middle of my the XML tags coming back which is causing Axis2 to have a hissy fit when it tries to parse them.

As far as I can tell this has something to do with HTTP 1.1 chunking which Axis2 isn't handling very well.

The issue I'm having is Identical to the issue in this forum post

How can I change the my webservice code to make it use HTTP 1.0 to avoid the chunking issue? As far as I can tell Axis defaults to CommonsHTTPSender anyway so I'm unsure why the forum post linked above suggested changing to that.

Alternatively is there a better way to solve this problem?

도움이 되었습니까?

해결책

You can directly turn off chunking:

stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);

You can also control both of these things through the axis2.xml config file, if you'd prefer. Find the following section:

<transportSender name="http"
    class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
    <parameter name="PROTOCOL">HTTP/1.1</parameter>
    <parameter name="Transfer-Encoding">chunked</parameter>
</transportSender>

You can change the PROTOCOL parameter to "HTTP/1.0", or remove the Transfer-Encoding parameter to disable chunking.

다른 팁

Found out how to do it, get the stub object that you you will use to call the service and add the following code after it:

stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION,
                org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_10);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top