PHP SOAP对象引用未设置为对象的实例
我尝试连接的服务是作为交易进行通信的Web服务程序。下面是XML格式的输入数据的结构PHP SOAP对象引用未设置为对象的实例,php,soap,Php,Soap,我尝试连接的服务是作为交易进行通信的Web服务程序。下面是XML格式的输入数据的结构 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Header> <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/ITradeService/CreateInternalMoveDoc</Action>
</s:Header>
<s:Body>
<CreateInternalMoveDoc xmlns="http://tempuri.org/">
<sessionId>496378b6-1f45-4720-8fa1-a2976eaa9523</sessionId>
<seqNumber>2</seqNumber>
<InternalMovDocInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<DocumentNumber>ԱՏՂ154</ DocumentNumber>
<DocumentDate>2016-02-15T00:00:00</DocumentDate>
<Comment>Ապրանքների տեղաշարժ կենտրոնական պահեստից</Comment>
<StorageExpenseCode>00</StorageExpenseCode>
<StorageIncomeCode>02</StorageIncomeCode>
<ChiefAccountantFIO />
<Mediator />
<Allower />
<BookNumber />
<BookPage>0</BookPage>
<BookRow>0</BookRow>
<TaxExportType />
<TaxInvoiceSeries />
<TaxInvoiceNumber />
<TaxInvoiceDate i:nil="true" />
<TransportationMethod />
<PriceType />
<BaseISN />
<Specification>
<InternalMoveSpecificationRow>
<ProductCode>1003</ProductCode>
<UnitCode>001</UnitCode>
<Quantity>1</Quantity>
<SalePrice>0</SalePrice>
<SaleAmount>0</SaleAmount>
</InternalMoveSpecificationRow>
</Specification>
</InternalMovDocInfo>
</CreateInternalMoveDoc>
我收到错误:对象引用未设置为对象的实例。它看起来像一行
$this->\u client=new SoapClient($this->\u url,$this->\u options)代码>不在函数内。将其移动到您的函数或放入构造函数中。它位于构造函数公共函数uu construct(){$this->\u client=new SoapClient($this->\url,$this->\u options);$this->\u session=$this->startSession();$this->dbConnect()}的内部。它看起来像一行$this->\u client=new SoapClient($this->\u url,$this->\u options);
不在函数中。请将其移动到函数中或放入构造函数中。它位于构造函数公共函数uu construct(){$this->\u client=new SoapClient($this->\u url,$this->\u options);$this->\u session=$this->startSession();$this->dbConnect()}
protected $_options = array(
'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
'style'=>SOAP_RPC,
'use'=>SOAP_ENCODED,
'soap_version'=>SOAP_1_1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'connection_timeout'=>15,
'trace'=>true,
'encoding'=>'UTF-8',
'exceptions'=>true,
);
public function __construct(){
$this->_client = new SoapClient($this->_url, $this->_options);
}
public function createInternalMoveDoc(){
$CreateInternalMoveDoc = $this->_client->CreateInternalMoveGEDoc(array(
'sessionId'=> $this->_session,
'seqNumber' => self::$_seqNumber,
'InternalMovDocInfo' => array(
'DocumentDate' => date('c',time()),
'StorageExpenseCode' => '17',
'StorageIncomeCode' => '06',
'Specification' => array (
'ProductCode' => '00145',
'UnitCode' => '1',
'Quantity' => '1',
'SalePrice' => '0',
'SaleAmount' => '0'
)
)
));
return $CreateInternalMoveDoc;
}
}