简体   繁体   English

php soap错误:对象引用未设置为的实例

[英]php soap Error :Object reference not set to an instance of an

I am trying to use this webservice 我正在尝试使用此Web服务

<?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>
    <ABRSearchByName xmlns="http://abr.business.gov.au/ABRXMLSearch/">
      <externalNameSearch>
        <authenticationGUID>string</authenticationGUID>
        <name>string</name>
        <filters>
          <nameType>
            <tradingName>string</tradingName>
            <legalName>string</legalName>
          </nameType>
          <postcode>string</postcode>
          <stateCode>
            <QLD>string</QLD>
            <NT>string</NT>
            <SA>string</SA>
            <WA>string</WA>
            <VIC>string</VIC>
            <ACT>string</ACT>
            <TAS>string</TAS>
            <NSW>string</NSW>
          </stateCode>
        </filters>
      </externalNameSearch>
      <authenticationGuid>string</authenticationGuid>
    </ABRSearchByName>
  </soap:Body>
</soap:Envelope>

below is my class definition 下面是我的班级定义

class abnlookup extends SoapClient{

    private $guid = "00000000"; 

    public function __construct($guid)
    {
        $this->guid = $guid;
        $params = array(
            'soap_version' => SOAP_1_1,
            'exceptions' => true,
            'trace' => 1,
            'cache_wsdl' => WSDL_CACHE_NONE
        ); 

        parent::__construct('http://abr.business.gov.au/abrxmlsearch/ABRXMLSearch.asmx?WSDL', $params);
    }

        public function searchByName($name){
            $params = new stdClass();
            $params->name= $name;
            $params->nameType= 'Y' ;
            $params->postcode= 'Y';
            $params->stateCode= 'N' ;           
    $params->authenticationGuid         = $this->guid;
                return $this->ABRSearchByName($params);
}  

call and create class object $abnlookup = new abnlookup($abn_guid); 调用并创建类对象$ abnlookup = new abnlookup($ abn_guid); $result = $abnlookup->searchByName($name); $ result = $ abnlookup-> searchByName($ name);

and recieve this msg Server was unable to process request. 并收到此msg服务器无法处理请求。 ---> Object reference not set to an instance of an object.second --->对象引用未设置为object.second的实例

The $params structure you are passing to ABRSearchByName is not correct. 传递给ABRSearchByName的$ params结构不正确。 According to WSDL this structure has two fields (as shown by __getTypes()): 根据WSDL,这个结构有两个字段(如__getTypes()所示):

struct ABRSearchByName {
 ExternalRequestNameSearch externalNameSearch;
 string authenticationGuid;
}

Create your $params with these two fields and the problem should be resolved. 使用这两个字段创建$ params,应该解决问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Soap错误:对象引用未设置为对象的实例 - Soap Error: Object reference not set to an instance of an object 从 PHP 连接到 SOAP 服务器的“对象引用未设置为对象的实例”错误 - "Object reference not set to an instance of an object" error connecting to SOAP server from PHP 错误:在PHP中调用SOAP cilent时“对象引用未设置为对象的实例” - Error : “Object reference not set to an instance of an object” when calling SOAP cilent in PHP 从PHP调用SOAP服务时出现“对象引用未设置为对象的实例”错误 - “Object reference not set to an instance of an object” error calling SOAP service from PHP 用PHP进行SOAP API调用,“对象引用未设置为对象的实例”! - SOAP API call with PHP, “Object reference not set to an instance of an object”! 获取对象引用未设置为对象的实例PHP Soap Client - Getting object reference not set to an instance of an object PHP Soap Client PHP,SOAP,.NET - 未将对象引用设置为对象的实例 - PHP, SOAP, .NET - Object reference not set to an instance of an object PHP SOAP问题:未将对象引用设置为对象的实例 - PHP SOAP Issue : Object reference not set to an instance of an object PHP服务器对对象引用的C#Soap客户端错误未设置为对象的实例 - PHP server has C# Soap client error on Object reference not set to an instance of an object NODEJS / PHP WSDL SOAP:对象引用未设置为对象的实例 - NODEJS / PHP WSDL SOAP: Object reference not set to an instance of an object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM