[esb-java-user] how to use http POST endpoint ?
Ruwan Linton
ruwan at wso2.com
Wed Oct 15 16:31:33 PDT 2008
Hi Eric,
Yes on the next release there will be a property which allows you to
turn off keep alive, but I guess HTTP 1.1 will always use chunking in
the next release as well, there were no requirement from the users to
use HTTP 1.1 with Content-Length yet...
Thanks,
Ruwan
Hubert, Eric wrote:
> Hi all,
>
> I may be wrong, but I don't think this would be a viable and useful
> option. To my knowledge any http 1.l compliant client MUST be able to
> receive chunked messages from the server side.
>
> So I think if you need to force the usage of conent length you have to
> use HTTP 1.0. You still should have the choice to use connection close
> (normally the default for HTTP 1.0) or keep alive (normally default for
> HTTP 1.1).
> Please note, that WSO2 ESB currently always uses keep alive, also using
> FORCE_HTTP_1.0, but I'm pretty sure the next release will offer support
> to also use connection close on demand. ;-)
> Generally you should prefer keep alive due to performance reasons, but
> there are some older app servers out, which do have there problems with
> keep alive.
>
> Regards,
> Eric
>
>
>> -----Original Message-----
>> From: esb-java-user-bounces at wso2.org [mailto:esb-java-user-
>> bounces at wso2.org] On Behalf Of Samisa Abeysinghe
>> Sent: Wednesday, October 15, 2008 8:07 PM
>> To: esb-java-user at wso2.org
>> Subject: Re: [esb-java-user] how to use http POST endpoint ?
>>
>> Can we not disable chinking with HTTP 1.1?
>>
>> Samisa...
>>
>> Ruwan Linton wrote:
>>
>>> Further, if you need the Content-Length to be present you need to
>>>
> add
>
>>> the following too;
>>>
>>> <syn:property name="FORCE_HTTP_1.0" value="true" scope="axis2"/>
>>>
>>> in to the inSequence. By default ESB uses HTTP 1.1 with chunking in
>>> which case the Content-Length is not there in the HTTP headers.
>>>
>>> Thanks,
>>> Ruwan
>>>
>>> Keith Chapman wrote:
>>>
>>>
>>>> Hi Harm,
>>>>
>>>> Here is how you could do it. You need to set two properties (at the
>>>> axis2 scope), The following is a sample config
>>>>
>>>> <?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="RESTProxy" startOnLoad="true">
>>>> <syn:target>
>>>> <syn:endpoint name="RESTEndpoint">
>>>> <syn:address
>>>> uri="http://localhost:7763/services/keith/test/foo" format="pox"/>
>>>> </syn:endpoint>
>>>> <syn:inSequence>
>>>> <syn:property name="messageType"
>>>> value="application/x-www-form-urlencoded" scope="axis2"/>
>>>> <syn:property name="HTTP_METHOD" value="post"
>>>> scope="axis2"/>
>>>> </syn:inSequence>
>>>> </syn:target>
>>>> </syn:proxy>
>>>> <syn:sequence name="main">
>>>> <syn:send/>
>>>> </syn:sequence>
>>>> <syn:sequence name="fault">
>>>> <syn:log/>
>>>> </syn:sequence>
>>>> </syn:definitions>
>>>>
>>>> Sample messages are:
>>>>
>>>> Request coming into ESB:
>>>>
>>>> POST /soap/RESTProxy/mediate HTTP/1.1
>>>> Content-Type: application/soap+xml; charset=UTF-8;
>>>> action="urn:anonOutInOp"
>>>> User-Agent: WSO2 Mashup Server - Version 1.5.1
>>>> Host: 127.0.0.1
>>>> Content-Length: 191
>>>>
>>>> <?xml version='1.0' encoding='UTF-8'?>
>>>> <soapenv:Envelope
>>>> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
>>>> <soapenv:Body>
>>>> <foo>
>>>> <param>keith</param>
>>>> </foo>
>>>> </soapenv:Body>
>>>> </soapenv:Envelope>
>>>>
>>>> Message Sent out by ESB:
>>>>
>>>> POST http://localhost:7763/services/keith/test/foo HTTP/1.1
>>>> Host: 127.0.0.1
>>>> Content-Type: application/x-www-form-urlencoded;
>>>> charset=UTF-8;action="urn:anonOutInOp";
>>>> Transfer-Encoding: chunked
>>>> Connection: Keep-Alive
>>>> User-Agent: Synapse-HttpComponents-NIO
>>>>
>>>> b
>>>> param=keith
>>>> 0
>>>>
>>>> Thanks,
>>>> Keith.
>>>>
>>>> Harm Verhagen wrote:
>>>>
>>>>
>>>>> I'm trying to figure out how to call a legacy HTTP interface
>>>>>
> from
>
>>>>> the esb bus.
>>>>>
>>>>> It expects an URL: http://host/issue?voucher='xml
>>>>> <http://host/issue?voucher=%27xml> document' with an http POST.
>>>>>
>>>>> sequence:
>>>>> 1) receive a soap request (proxy)
>>>>> 2) xlst mediator (builds the xml document to be posted).
>>>>> 3) then a POX endpoint with URl http://host/issue
>>>>>
>>>>> 1. The message send to the server however doesn't have
>>>>> "Content-Length:" set.
>>>>> 2. The start of the http POST part "voucher=" is missing.
>>>>> 3. Also It isn't Content-Type: application/x-www-form-urlencoded
>>>>>
> but
>
>>>>> rather application/xml; charset=UTF-8
>>>>> (It can be www-form-urlencoded... with REST/GET but then its not
>>>>>
> a
>
>>>>> POST...)
>>>>>
>>>>> Any idea how I can make it application/x-www-form-urlencoded, and
>>>>> with the voucher= parameter.
>>>>>
>>>>>
>>>>>
>>>>> *example of a working (without esb) call*
>>>>> POST /vts/issue HTTP/1.1
>>>>> Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXX
>>>>> User-Agent: Jakarta Commons-HttpClient/3.1
>>>>> Host: XX.XX.XX
>>>>> Cookie: $Version=0; JSESSIONID=16ami6ulq3mqr; $Path=/vts
>>>>> Content-Length: 358
>>>>> Content-Type: application/x-www-form-urlencoded
>>>>>
>>>>> voucher=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-
>>>>>
> 8%22%3F%3E%0A%3CVoucher+xmlns%3D%22urn%3Aietf%3Aparams%3Axml%3Ans%3Avts-
>
> issue%22+title%3D%22dfdadfdsfsa%22+key%3D%221233455%22+ean8%3D%221233455
> %2
>
> 2%3E%3CDescription%3Egsfdgfdgf%3C%2FDescription%3E%3CIssuer+name%3D%22op
> %2
>
> 2%2F%3E%3CHolder+phone-number%3D%22%2B31655325465%22%2F%3E%3C%2FVoucher%
> 3E
>
>>>>> *What I got now*
>>>>> POST http://192.168.6.108:100/vts/issue?voucher= HTTP/1.1
>>>>> Host: XX.XX.XX.XX
>>>>> Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXX
>>>>> SOAPAction: ""
>>>>> Content-Type: application/xml; charset=UTF-8
>>>>> Transfer-Encoding: chunked
>>>>> Connection: Keep-Alive
>>>>> User-Agent: Synapse-HttpComponents-NIO
>>>>>
>>>>> d7
>>>>> <Voucher xmlns="urn:ietf:params:xml:ns:vts-issue" ean8="123456"
>>>>> key="123456" title="Hier is uw ticket">
>>>>> <Description>Bla</Description>
>>>>> <Issuer name="op" />
>>>>> <Holder email="myemail at mail.com <mailto:myemail at mail.com>" />
>>>>> </Voucher>
>>>>> 0
>>>>>
>>>>>
>>>>>
>>>>> Regards,
>>>>> Harm
>>>>>
>>>>>
> ----------------------------------------------------------------------
>
>> --
>>
>>>>> _______________________________________________
>>>>> Esb-java-user mailing list
>>>>> Esb-java-user at wso2.org
>>>>> http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>>>>>
>>>>>
>>>>>
> -----------------------------------------------------------------------
>
>> -
>>
>>>> _______________________________________________
>>>> Esb-java-user mailing list
>>>> Esb-java-user at wso2.org
>>>> http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Esb-java-user mailing list
>>> Esb-java-user at wso2.org
>>> http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>>>
>>>
> ------------------------------------------------------------------------
>
>>> No virus found in this incoming message.
>>> Checked by AVG - http://www.avg.com
>>> Version: 8.0.173 / Virus Database: 270.8.0/1726 - Release Date:
>>>
>> 10/15/2008 7:29 AM
>>
>>>
>> --
>> Samisa Abeysinghe
>> Director, Engineering; WSO2 Inc.
>>
>> http://www.wso2.com/ - "The Open Source SOA Company"
>>
>>
>> _______________________________________________
>> Esb-java-user mailing list
>> Esb-java-user at wso2.org
>> http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>>
>
> _______________________________________________
> Esb-java-user mailing list
> Esb-java-user at wso2.org
> http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>
>
More information about the Esb-java-user
mailing list