我对SOAP没有相对经验.我试图使用WSDL模式为客户端使用Web服务.我在使用该方法传递参数时遇到问题,并让它们根据需要显示在请求中的参数.我正在使用标准的php soap类.
我需要将SOAP请求的结构如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://hostserver/">
<SOAP-ENV:Body>
<ns1:DoLogin>
<ns1:request>
<ns1:Session>
<ns1:SessionId>00000000-0000-0000-0000-000000000000</ns1:SessionId>
</ns1:Session>
<ns1:UserCredential>
<ns1:UserName>username</ns1:UserName>
<ns1:Password>password</ns1:Password>
<ns1:ApplicationID>00000000-0000-0000-0000-000000000000</ns1:ApplicationID>
<ns1:ClientID>00000000-0000-0000-0000-000000000000</ns1:ClientID>
<ns1:ClientVersion>V1.0</ns1:ClientVersion>
</ns1:UserCredential>
</ns1:request>
</ns1:DoLogin>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)
在PHP中我调用函数如下:
$client->DoLogin($args);
Run Code Online (Sandbox Code Playgroud)
请求最终会像这样:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://hostserver/"><SOAP-ENV:Body><ns1:DoLogin/></SOAP-ENV:Body></SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)
无论我如何传递args(单个varabiables,数组,类对象),我都无法获得具有该结构的请求.
谁能帮我?我相信它会变得非常简单.