|
[
Permlink
| « Hide
]
Glen Mazza added a comment - 06/Sep/07 05:38 PM
eBay sample WSDL (version 527)
Using Wireshark is showing that my CXF-based client is getting this error response from the EBAY server:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>411 Length Required</TITLE> </HEAD><BODY> <H1>Length Required</H1> A request of the requested method POST requires a valid Content-length.<P> chunked Transfer-Encoding forbidden: /shopping<P> </BODY></HTML> I'll check to see next why using the Metro instead of CXF doesn't have this problem. It would be good if we could have the error stack in the previous comment include the above HTML error response message, instead of the present "Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers" message, which isn't very informative. I wonder if the woodstox folks would like to make such a change. (*Many* thanks by the way to Dan K. for his suggestion to use Wireshark. I did not know of this tool, it makes troubleshooting much easier!) This may not be a CXF bug after all. The eBay web service requires the Content-Length header to be set.
Using Wireshark, I see that, for client requests, Metro always sets the Content-Length but not the Transfer-Encoding; while CXF does the exact opposite. But according to the HTTP 1.1 standard[1], that should be fine--either the Content-Length or the Transfer-Encoding should be set but not both, and a HTTP 1.1 compliant server must be able to accept Transfer-Encoding. So perhaps eBay is wrong in requiring Content-Length. Can we manually set the Content-Length from client code? I guess I would have to also remove Transfer-Encoding to be compliant with the HTTP 1.1 spec. At any rate, my next step is to take this issue to one of the eBay help forums. [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4 I just asked a question on the eBay developer forum on this issue:
http://dev-forums.ebay.com/thread.jspa?threadID=500003939&tstart=0&mod=1189892458577 Glen, In the client side spring config, you can set the client side to set "AllowChunking=false" for the client http config. That's definitely slower (cannot do full streaming), but should work. Thanks, but I'm not using Spring (although I can move to that if indeed necessary). Is there a way to turn off chunking within a simple Java class (bullet (7) of here: http://www.jroller.com/gmazza/date/20070817)?
Once I make this change, I will check to make sure that with chunking turned off, the Content-Length header is set instead (as it apparently should be, right?) Glen Problem fixed! I just needed to switch off chunking, which causes the Content-Length header to get sent instead, and the eBAY WSDL to work fine with CXF.
Here is the cxf.xml file that needs to be placed in the classpath: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <http-conf:conduit name="{urn:ebay:apis:eBLBaseComponents}Shopping.http-conduit"> <http-conf:client AllowChunking="false"/> </http-conf:conduit> </beans> This issue can be closed as "invalid". You can write java code to set the client policy
SOAPService service = new SOAPService(wsdl, serviceName); Greeter greeter = service.getPort(bethalQ, Greeter.class); Client client = ClientProxy.getClient(greeter); HTTPConduit http = (HTTPConduit) client.getConduit(); HTTPClientPolicy httpClientPolicy = http.getClient(); httpClientPolicy.setAllowChunking(false); |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||