In this post, i will show you How to send soap envelope XML requests in PHP. No need to declare a long request array, just simple pass soap xml as request using header information. The
soap envelope contains the headers and soap body. You need to call a function or method on a web server with some parameters to process the request. Some users might get confused when seeing the soap XML request format. Like they use SOAPAction URL value as request action or don’t get the header parameters. In this tutorial, we are going to clear your confusion. Let’s see how soap envelope XML look like.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 POST/webserviceexternal/contracts.asmx HTTP/1.1 Host:example.com Content-Type:text/xml;charset=utf-8 Content-Length:
length SOAPAction:"//example.com/CreateItems"
string string
int string int
string
string
Soap Envelope XML Request Format is like
that:
As you see above Host, Content-Type, Content-Length, and SoapAction, all are the header parameters.
And right below is the XML request string you need to pass. Make sure you put the right value in XML parameter element.
You May Also Like:
How to Authenticate with D&B Direct API Web Service
How to Implement UPS API and Create Shipping Label
How to Get User Data From Slideshare.net API
How to Send Order Data in Shipstation Via API Call
How to Post Soap Envelop XML Request in PHP
We can post soap XML using curl method. Define the curl request header and post the soap envelop XML data. Check the below code to execute this request.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
Chủ Đề |