martes, 28 de julio de 2009

Using Curl to test Webservices

Curl is a swiss-knife tool for almost every task related to the www.
I have found it very useful when used as a way to send the xml for a webservice.
The parameters required to achive this functionality are:
* --data
* -H |HeaderName:Value|
--data: allows us to include a file (with de @ symbol) that contains the xml to post to the application server
-H: Contains the header/s for the http connection. On some application servers SOAPAction is required.

curl --data @rsi.xml http://172.22.2.164:9080/SOAPlatform/services/SOAPlatform -H "SOAPAction: ''"

This is the example xml request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ms="http://xxxx" xmlns:mod="http://yyyy">
<soapenv:Header>

</soapenv:Header>
<soapenv:Body>
<ms:XYTZ>
<mod:data1>UXX0001</mod:data1>
<mod:data2>3008</mod:data2>
<mod:data3>W0000001</mod:data3>
</ms:VYTZ>
</soapenv:Body>
</soapenv:Envelope>

No hay comentarios:

Publicar un comentario