如何使用PHP验证SOAP服务

时间:2015-03-04 07:36:16

标签: php xml soap

我尝试使用PHP验证以下请求,但它无法正常工作

以下是我的以下SOAP请求

POST /BCWebservice/BCWebService.asmx HTTP/1.1
Host: service.bcstaging.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.bcstaging.com/bc/Authenticate"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Authenticate xmlns="http://www.bcstaging.com/bc">
      <username>string</username>
      <password>string</password>
      <version>string</version>
      <eaCode>int</eaCode>
    </Authenticate>
  </soap:Body>
</soap:Envelope>

这是我的PHP代码

    $soapURL = "http://service.bcstaging.com/BCWebService.asmx?wsdl";
    $soapParameters = array(
        'Username' => $username,
        'Password' => $password,
        'ProductVersion' => '2.9.0.0',
        'EACode' => $eaCode
        );
    $soapClient = new SoapClient($soapURL);
   $objResponse = $soapClient->__soapCall('Authenticate', $soapParameters);

我收到以下错误

Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. 

任何帮助将不胜感激。提前谢谢。

0 个答案:

没有答案