Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Posting XML data to a Web Service

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/">
<password>?</password> //THIS IS WHERE MY PASSWORD GOES TO

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.