Adding a content-length value does seem to solve the problem, thought I've not
been able to find anything definitive in the HTTP spec that states either a
content-length or transfer-encoding (=chunked) must be present.
The suggestion of turning off HTTP chunking on the client would be a good
workaround, but I'm having the problem that the CXF client is not picking up my
http-conduit settings.
Here is my client-beans.xml config:
<bean id="client" class="com.xyz.webservicesclient.client.JaxWS"
factory-bean="clientFactory" factory-method="create" />
<bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass"
value="com.xyz.webservicesclient.client.JaxWS" />
<property name="address" value="http://dev.xyz.com/WebServices/jaxws" />
<property name="username" value="xyz" />
<property name="password" value="xyz" />
</bean>
<http-conf:conduit name="*.http-conduit">
<http-conf:client AllowChunking="false"/>
</http-conf:conduit>
I've also tried explicitly using the WSDL port name to configure the conduit,
but no luck. Any ideas where I'm going wrong?
Thanks,
Adam
----- Start Original Message -----
Sent: Mon, 26 Jan 2009 13:35:55 -0500
From: Daniel Kulp <[email protected]>
To: [email protected]
Subject: Re: HTTP chunking/proxy issues
>
> It looks like the proxy server is de-chunking, but then not providing a
> Content-Length header. You really need one or the other. Personally, to
> me, this is a bug in the proxy server.
>
> That said, turning off chunking on the client may fix it. The client would
> send a Content-Length header which, if the proxy server sends through
> properly, should allow the server to work correctly.
>
> Dan
>
>
> On Monday 26 January 2009 11:44:12 am Adam Ross wrote:
> > Hi all,
> >
> > I'm having a problem accessing CXF web services via a proxy server.
> > Investigation has shown that the proxy is dechunking the HTTP, which
> > appears to cause CXF to fail with a "Error reading XMLStreamReader"
> > exception on the server.
> >
> > Here's a working (chunked) HTTP request (avaoiding the proxy):
> >
> > POST /WebServices/jaxws HTTP/1.1
> > Content-Type: text/xml; charset=UTF-8
> > Authorization: Basic dHVpOjVlYTUxZGU=
> > SOAPAction: ""
> > Accept: *
> > Cache-Control: no-cache
> > Pragma: no-cache
> > User-Agent: Java/1.6.0_06
> > Host: 127.0.0.1:80
> > Connection: keep-alive
> > Transfer-Encoding: chunked
> >
> > 1d9
> > <soap:Envelope
> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getH
> >otelDetails
> > xmlns:ns2="http://jaxws.webservices.xxx.com/"><cpId>/geo/Europe/Great_Brita
> >in/England/London/hotels/The_Ritz_London</cpId><basicOptions><feedPreference
> >>XXX_XML</feedPreference><language>en-gb</language></basicOptions><destinati
> >onDepth><depth>2</depth></destinationDepth><poiDepth><depth>2</depth></poiDe
> >pth></ns2:getHotelDetails></soap:Body></soap:Envelope> 0
> >
> > And here's a dechunked request via the proxy - which does not work:
> >
> > POST /WebServices/jaxws HTTP/1.1
> > Host: 127.0.0.1:80
> > Content-Type: text/xml; charset=UTF-8
> > Authorization: Basic dHVpOjVlYTUxZGU=
> > SOAPAction: ""
> > Accept: *
> > Cache-Control: no-cache
> > Pragma: no-cache
> > User-Agent: Java/1.6.0_06
> > Max-Forwards: 10
> > X-Forwarded-For: 10.2.200.106
> > X-Forwarded-Host: dev.xxx.com:1235
> > X-Forwarded-Server: dev.xxx.com
> >
> > <soap:Envelope
> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getH
> >otelDetails
> > xmlns:ns2="http://jaxws.webservices.xxx.com/"><cpId>/geo/Europe/Great_Brita
> >in/England/London/hotels/The_Ritz_London</cpId><basicOptions><feedPreference
> >>XXX_XML</feedPreference><language>en-gb</language></basicOptions><destinati
> >onDepth><depth>2</depth></destinationDepth><poiDepth><depth>2</depth></poiDe
> >pth></ns2:getHotelDetails></soap:Body></soap:Envelope>
> >
> > Any thoughts? This seems to be the opposite of other peoples probs where
> > CXF does not work with chunked HTTP.
> >
> > Thanks,
> > Adam
>
>
>
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog
>
----- End Original Message -----