在我的 SoapClient 中,请求 XML 应该如下所示:
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope">
<SOAP-ENV:Body>
<SoapFunction xmlns="http://services.***/">
<prop1>value1</prop1>
<prop2>value2</prop2>
<prop3>
<KeyValuePair>
<Key>string</Key>
<Value>string</Value>
</KeyValuePair>
<KeyValuePair>
<Key>string</Key>
<Value>string</Value>
</KeyValuePair>
</prop3>
</SoapFunction>
</SOAP-ENV:Body>
</sSOAP-ENV:Envelope>
我可以通过以下代码正确构建 prop1 和 prop2:
$parameters = array(
'prop1' => value1,
'prop2' => value2
);
$request = array($parameters);
$client->__soapCall('SoapFunction', $request);
但是我如何构建属性 prop3,尤其是构建在 WSDL 文件中定义的类型KeyValuePair