我有一个WSDL文件。使用SOAP UI,我能够生成SOAP请求消息......
请求SOAP消息:
<?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>
以下是响应SOAP消息:
<?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>
问题:
使用PHP的SoapClient,我该怎么做:
我浏览了之前有关SOAP和WSSE标头的StackOverflow问题,但找不到答案。
非常感谢您的时间和专家的帮助!
PS:我可以使用cURL完成上述操作。但我想知道如何使用SoapClient来做到这一点。再次感谢!