Alex / Paul / Sanjiva My sincere apologies for the delay in responding..
Let me first explain the reasons behind this issue you encountered before I tell you the solution.. The Content-Length HTTP header states the size of the payload about to be sent over the wire to the receiving party - so that it knows when the payload has been received completely. However there are some drawbacks in using this, especially with services that may produce large payloads, or payload would be generated over some time (e.g. like streaming as data becomes available). Thus HTTP 1.1 introduced chunked encoding, where HTTP 1.1 capable endpoints could receive data as chunks as-and-when these becomes available. Since chunked encoding is more efficient and does not require the sender to compute the length of the full payload by buffering it in memory first, the ESB tries to use HTTP 1.1 by default. This is done irrespective of the fact that the request may have used Content-Length header.. well it may have come over JMS or even VFS anyway!.. so unless you ask the ESB to use HTTP 1.0 for outgoing requests, we will default to using HTTP 1.1 You could use the following property to force the use of HTTP 1.0 for outgoing requests <property name="FORCE_HTTP_1.0" value="true" scope="axis2-client"/> Now if you do a trace, you will notice that the previous: POST http://localhost:9001/soap/SimpleStockQuoteService *HTTP/1.1* Host: 127.0.0.1 SOAPAction: urn:getQuote Content-Type: text/xml; charset=UTF-8 Transfer-Encoding: *chunked* Connection: Keep-Alive User-Agent: Synapse-HttpComponents-NIO has changed to: POST http://localhost:9001/soap/SimpleStockQuoteService* HTTP/1.0* Host: 127.0.0.1 SOAPAction: urn:getQuote Content-Type: text/xml; charset=UTF-8 *Content-Length: 328* Connection: Keep-Alive User-Agent: Synapse-HttpComponents-NIO Let me know if you have any more problems asankha Paul Fremantle wrote: > I've just looked at the code, and it deliberately removes the > Content-Length header! Basically it might be there from the incoming > message and so it deletes it before sending. > > Let me see if there is an easy fix. > > Paul > > Alex Reis wrote: >> Paul/All >> >> I've tried adding the property mediator as paul said, but the request >> sent to the proxyed endpoint still doesn't have Content-Length. Tcp >> monitor show the following request being sent: >> >> -- >> POST http://localhost:12345/wsa/wsa1 HTTP/1.1 >> Host: 192.168.5.30:12345 >> SOAPAction: "" >> Content-Type: text/xml; charset=UTF-8 >> Transfer-Encoding: chunked >> Connection: Keep-Alive >> User-Agent: Synapse-HttpComponents-NIO >> >> 14d >> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >> xmlns:urn="urn:dtsl.ems2.cadastros.services.itemdocument:ItemDocument"><soapenv:Body> >> >> <urn:getItems> >> <urn:idGrupoEstoque>81</urn:idGrupoEstoque> >> </urn:getItems> >> </soapenv:Body></soapenv:Envelope> >> 0 >> -- >> >> synapse XML config follows: >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <syn:definitions xmlns:syn="http://ws.apache.org/ns/synapse"> >> >> <syn:registry provider="org.wso2.esb.registry.ESBRegistry"> >> >> <syn:parameter name="root">file:registry/</syn:parameter> >> >> </syn:registry> >> >> <syn:proxy name="ItemNovo" transports="http" startOnLoad="true" >> statistics="enable" trace="enable"> >> >> <syn:target> >> >> <syn:endpoint> >> >> <syn:address uri="http://localhost:12345/wsa/wsa1"/> >> >> </syn:endpoint> >> >> <syn:inSequence> >> >> <syn:property name="Content-Length" value="328" >> scope="transport"/> >> >> <syn:log level="full" separator="--"/> >> >> </syn:inSequence> >> >> <syn:outSequence> >> >> <syn:send/> >> >> </syn:outSequence> >> >> </syn:target> >> >> <syn:publishWSDL >> uri="http://192.168.5.30:8080/wsa/wsa1/wsdl?targetURI=urn:dtsl.ems2.cadastros.services.itemdocument"/> >> >> >> </syn:proxy> >> >> <syn:sequence statistics="enable" name="main" trace="enable"> >> >> <syn:in> >> >> <syn:log level="full"/> >> >> <syn:filter source="get-property('To')" >> regex="http://localhost:9000.*"> >> >> <syn:send/> >> >> </syn:filter> >> >> </syn:in> >> >> <syn:out> >> >> <syn:send/> >> >> </syn:out> >> >> </syn:sequence> >> >> <syn:sequence statistics="enable" name="fault" trace="enable"> >> >> <syn:log/> >> >> </syn:sequence> >> >> </syn:definitions> >> >> >> >> >> >> On Dec 21, 2007 9:42 AM, Paul Fremantle <[EMAIL PROTECTED]> wrote: >>> Thanks Alex! >>> >>> Paul >>> >>> -------- Original Message -------- >>> Subject: [esb-java-dev] [jira] Created: (ESBJAVA-415) When sending SOAP >>> requests to HTTP endpoints, the Content-Length header is not sent, even >>> if the original request has it >>> Date: Fri, 21 Dec 2007 03:40:04 -0800 (PST) >>> From: Alex Reis (JIRA) <[EMAIL PROTECTED]> >>> Reply-To: [EMAIL PROTECTED] >>> To: [EMAIL PROTECTED] >>> >>> When sending SOAP requests to HTTP endpoints, the Content-Length header >>> is not sent, even if the original request has it >>> ------------------------------------------------------------------------------------------------------------------------ >>> >>> >>> Key: ESBJAVA-415 >>> URL: http://wso2.org/jira/browse/ESBJAVA-415 >>> Project: WSO2 ESB >>> Issue Type: Bug >>> Components: Core Engine >>> Affects Versions: 1.5 >>> Environment: Windows, wso2esb 1.5 release >>> Reporter: Alex Reis >>> Assigned To: Asankha Perera >>> >>> >>> Whenever I try to proxy the Progress OpenEdge WebServices Adapter >>> services within the ESB and invoke it, I >>> get the response Error in SOAP Envelope: Content length must be >>> specified. (10913). >>> >>> If I invoke it directly through soapUI, it works AS LONG as I provide >>> the Content-Length header manually. >>> >>> So what I need to do is setup an input sequence that adds the >>> Content-Length headers with the payload + soap headers size. I tried >>> using the Header mediator but it only adds the SOAP headers, not HTTP. >>> >>> There should be a way to do this in Synapse/WSO2 ESB. >>> >>> -- >>> This message is automatically generated by JIRA. >>> - >>> If you think it was sent incorrectly contact one of the administrators: >>> http://wso2.org/jira/secure/Administrators.jspa >>> - >>> For more information on JIRA, see: >>> http://www.atlassian.com/software/jira >>> >>> >>> >>> _______________________________________________ >>> Esb-java-dev mailing list >>> [EMAIL PROTECTED] >>> http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev >>> >>> >>> -- >>> Paul Fremantle >>> Co-Founder and VP of Technical Sales, WSO2 >>> OASIS WS-RX TC Co-chair >>> >>> Office: +1 646 290 8050 >>> Cell: +44 798 447 4618 >>> >>> blog: http://pzf.fremantle.org >>> [EMAIL PROTECTED] >>> >>> "Oxygenating the Web Service Platform", www.wso2.com >>> >>> _______________________________________________ >>> Esb-java-user mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/esb-java-user >>> >> >> >> >
_______________________________________________ Esb-java-user mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/esb-java-user
