0

我正在尝试使用 PHP SoapClient 调用 SOAP WebService,与 WSDL 连接,一切都很好。但是当我传递参数进行调用时,我意识到(使用“__getLastRequest()”)参数没有放在我的“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>
4

1 回答 1

0

原来你需要在正文中包含整个调用。现在听起来不言自明!

$soapMessage = array(
  'MyFunction' => 
  array(
    'order' =>
    array(
      'DealerCode' => 'Val1',
      'AscCode' => 'Val2',
    ),
  ),
)
$result = $client->__soapCall('MyFunction', $soapMessage);
于 2012-10-10T06:31:20.927 回答