Friday, July 16, 2010

How to generate HTTP 1.0 requests

While verifying some scenarios with WSO2 ESB I had the need to send HTTP 1.0 POST messages. Then came cURL to the rescue. I just had to use the option -0 or --http1.0 when sending the request like shown below.

$ curl -s "http://localhost:8280/services/Axis2Service" -d @soap11_echoString.xml -H "Content-Type:text/xml; charset=UTF-8" -H "SOAPAction: urn:echoString" -0


$ curl -s "http://localhost:8280/services/Axis2Service" -d @soap11_echoString.xml -H "Content-Type:text/xml; charset=UTF-8" -H "SOAPAction: urn:echoString" --http1.0

When viewed through TCPMon, you will see how it sends a HTTP 1.0 message

POST /services/Axis2Service HTTP/1.0
User-Agent: curl/7.18.2 (x86_64-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/ libidn/1.10
Accept: */*
Content-Type:text/xml; charset=UTF-8
SOAPAction: urn:echoString
Content-Length: 273

<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="">
<ser:echoString xmlns:ser="">

No comments: