Posting XML data to a Web Service

Posted 3 years ago by jaahvicky

I have tried to search for a solution on the internet on how to POST data to a SOAP webservice using PHP but I cant seem to get it right, please note this is my first time using SOAP. I have a webservice endpoint

http://test/soap/job-import.ws?wsdl //TEST URL ENDPOINT

and the request returns the below.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.test.jobs.de/">
<soapenv:Header/>
<soapenv:Body>
<soap:import-listing>
<!--Optional:-->
<user>?</user> //THIS IS WHERE MY USERNAME GOES TO
<!--Optional:-->
<password>?</password> //THIS IS WHERE MY PASSWORD GOES TO
<!--Optional:-->
<xml>?</xml>  //THIS IS WHERE MY XML FILE GOES TO
</soap:import-listing>
</soapenv:Body>
</soapenv:Envelope>

Most answers that I am coming across suggest that I must use PHP's SoapClient class and I cant seem to get it right or understand how to use this class.

I do have the username and password and required xml. When i use SOAPUI the tests are successful but when i try to put this into code, I just cant get it right. Can someone please point me to the right direction on how to accomplish this task.

Any sample code or links will be grately appreciated.

If my question needs more clarification please let me know so that I can try to make the question more before I get downvoted.

Thank you in advance.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.