Linux - curl command to call SOAP Web services

13:17 JPCO 0 Comments




curl is a tool open source to transfer data through URL, support several protocols, in this case we will use for HTTP . curl it's a command in linux very simple to invoke soap web services from the console we can execute this command following the next steps,

As you can see the -H parameter is to specify the http-headers(Authorization, content-type,accept ,...) , -d parameter is to specify the the xml content and finally -K is to specify the http method in this case is POST
Curl command in linux
curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:" -d @request.xml -X POST -k https://localhost/soap-ws/services/getDataClient/client
Xml content inside of @request.xml
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="0" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-27148830" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>userNameTest</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">passwordTest</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<getDataClient xmlns="http://xmlns.oracle.com/bpel/getDataClient">
<client_id xmlns="">7777777</client_id>
</getDataClient>
</soapenv:Body>
</soapenv:Envelope>

you can find more information in http://curl.haxx.se/

0 comentarios: