I have a WSDL file. Using SOAP UI, I was able to generate the SOAP request message...
Request SOAP message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="ABCGID-123456789">
<wsse:Username>Spiderman</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">spinningtheweb</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<FooInterface_Bar_Input xmlns="http://example.com/interfaces">
<Input1>Howdy</Input1>
<Input2>Partner</Input2>
</FooInterface_Bar_Input>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
And here is the response SOAP message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns:FooInterface_Bar_Output xmlns:ns="http://example.com/interfaces">
<ns:Output1>Banana</ns:Output1>
<ns:Output2>Papaya</ns:Output2>
<listOfOtherOutputs>
<Output3>Apple</Output3>
</listOfOtherOutputs>
</ns:FooInterface_Bar_Output>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
QUESTION:
Using PHP's SoapClient, how do I:
- init SoapClient and load the WSDL file (which sits in my server)?
- Set the header?
- Send the SOAP request?
- And finally, get a SOAP response back and extract the values of Output1, Output2, and Output3 into variables?
I've browse previous StackOverflow questions regarding SOAP and WSSE headers, but could not find the answer.
Thanks very much in advance for your time and your expert help!
PS: I can accomplish the above using cURL. But I want to know how to do it using SoapClient. Thanks again!