Thursday, February 11, 2016

Calling a web service from Unix using Curl

Problem:

Create a request message:
echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:chec=\"http://xmlns.oracle.com/MOUS/HealthCheck/CheckBPEL\">" > /tmp/request.xml 
echo "   <soapenv:Header/>"  >> /tmp/request.xml 
echo "   <soapenv:Body>"     >> /tmp/request.xml 
echo "      <chec:process/>" >> /tmp/request.xml 
echo "   </soapenv:Body>"    >> /tmp/request.xml 
echo "</soapenv:Envelope>"   >> /tmp/request.xml

Invoke the web service using curl:
curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: \"http://soadev:8001/soa-infra/services/default/HealthCheck/checkbpel_client_ep\"" --data-binary @/tmp/request.xml http://soadev:8001/soa-infra/services/default/HealthCheck/checkbpel_client_ep?WSDL > /tmp/response.xml

View the contents of the response:
cat /tmp/response.xml



3 comments:

Priscilla said...

This information is impressive..I am inspired with your post writing style & how

continuously you describe this topic. After reading your post,thanks for taking the

time to discuss this, I feel happy about it and I love learning more about this topic..

Peridot Systems Adyar Complaints

Unknown said...

Hi

could you please let us know how to do the reverse


Call curl from SOA

Ahmed Aboulnaga said...

Can you give a bit more details on your use case, so that I can understand why you want to do that. Thanks.