我正在尝试使用PHP SoapClient调用SOAP WebService,使用WSDL连接并且一切都很好而且花花公子。但是当我传递参数来进行调用时,我意识到(使用“__getLastRequest()”)params并没有放在我的“MyFunction”里面而是放在外面..
PHP代码:
$client = new SoapClient("http://wsdlurl.com?WSDL", array("trace" => 1));
$soapMessage = array(
'DealerCode' => 'Val0',
'AscNumber' => 'Val1',
'CustOrderNumber' => 'Val2',
'OrderDate' => 'Val3',
'OrderType' => 'Val4',
'ModelCode' => 'Val5',
'ObjectName' => 'Val6',
'BrandName' => 'Val7',
'SerialNumber' => 'Val8',
'Name' => 'Val9',
'Address' => 'Val10',
'PostalCode' => 'Val11',
'Town' => 'Val12',
'TelephoneNR' => 'Val13',
'EmailAddress' => 'Val14',
'Company' => 'Val15',
'DoorCode' => 'Val16',
'CustFaultDescription' => 'Val17',
'InWarranty' => 'Val18',
'PurchaseDate' => 'Val19',
'FaultCode' => 'Val20',
'GeneralMessage' => 'Val21'
);
$result = $client->__soapCall('MyFunction', $soapMessage);
$request = $client->__getLastRequest();
发送此请求的结果??
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.url.com/">
<SOAP-ENV:Body>
<ns1:MyFunction/>
<param1>Val1</param1>
<param2>Val2</param2>
<param3>Val3</param3>
<param4>Val4</param4>
<param5>Val5</param5>
<param6>Val6</param6>
<param7>Val7</param7>
<param8>Val8</param8>
<param9>Val9</param9>
<param10>Val10</param10>
<param11>Val11</param11>
<param12>Val12</param12>
<param13>Val13</param13>
<param14>Val14</param14>
<param15>Val15</param15>
<param16>Val16</param16>
<param17>Val17</param17>
<param18>Val18</param18>
<param19>Val19</param19>
<param20>Val20</param20>
<param21>Val21</param21>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
答案 0 :(得分:0)
原来你需要在整个身体中包含整个召唤。现在听起来自我解释了!
$soapMessage = array(
'MyFunction' =>
array(
'order' =>
array(
'DealerCode' => 'Val1',
'AscCode' => 'Val2',
),
),
)
$result = $client->__soapCall('MyFunction', $soapMessage);