PHP调用WSDL soap asmx webservice

时间:2015-02-25 16:51:39

标签: php web-services soap wsdl

我有来自SOAP ASMX webService的这个WSDL

  <s:element name="Login">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="pr_UserName" type="s:string" />
        <s:element minOccurs="0" maxOccurs="1" name="pr_Password" type="s:string" />
        <s:element minOccurs="1" maxOccurs="1" name="pr_AbortExistingSession" type="s:boolean" />
      </s:sequence>
    </s:complexType>
  </s:element>
  <s:element name="LoginResponse">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="1" maxOccurs="1" name="LoginResult" type="s:boolean" />
      </s:sequence>
    </s:complexType>
  </s:element>

在php中我做:

$client = new SoapClient("http://MyWebService.asmx?WSDL");
$result = $client->Login(array('pr_UserName' => 'MYACCOUNT', 'pr_Password' => 'MYPASSWORD', 'pr_AbortExistingSession' => 'true' ))->LoginResult;        
echo $result;

我收到此错误:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object. at NjoynDataGateway.Login(String pr_UserName, String pr_Password, Boolean pr_AbortExistingSession) --- End of inner exception stack trace --- 

知道我做错了吗?

感谢您的帮助!!

0 个答案:

没有答案