[英]Web Service with .net and nusoap
我正在使用nusoap連接到.net服務,但我得到錯誤“注意:未定義的變量:第54行的C:\\ xampplite \\ htdocs \\ newsoap \\ searchwwcc.php中的HEADER
致命錯誤:未捕獲的SoapFault異常:[Client]函數(“serializeEnvelope”)在C:\\ xampplite \\ htdocs \\ newsoap \\ searchwwcc.php中不是此服務的有效方法:54堆棧跟蹤:#0 [內部函數]:SoapClient - > __ call('serializeEnvelo ...',Array)#1 C:\\ xampplite \\ htdocs \\ newsoap \\ searchwwcc.php(54):SoapClient-> serializeEnvelope('
這是我正在使用的參考代碼
require_once('lib/nusoap.php');
$serverpath ='https://service.website.net/ws/bridge.asmx?wsdl';
$SOAPClient = new soapclient($serverpath);
$SOAPACTION = "http://connect2.askadmissions.net/webservices/GetContact";
$BODY='<?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>
<GetContact xmlns="http://service.website.net/webservices/">
<ClientName>clientname</ClientName>
<PassKey>*******</PassKey>
<SearchCriteriaXml>
<![CDATA[
<attributes>
<attribute>
<name>email</name>
<value>name@name.com</value>
<operator>equals</operator>
</attribute>
</attributes>
]]>
</SearchCriteriaXml>
<AttributesXml>
<![CDATA[
<attributes>
<attribute>
<name>firstname</name>
</attribute>
<attribute>
<name>lastname</name>
</attribute>
</attributes>
]]>
</AttributesXml>
</GetContact>
</soap:Body>
</soap:Envelope>';
$SOAPMESSAGE = $SOAPClient->serializeEnvelope($BODY,$HEADER,array(),'document', 'literal');
$RESULT = $SOAPClient->send($BODY, $SOAPACTION);
echo $SOAPClient->response;
我發現了什么是錯的:
我改線:
$SOAPClient = new soapclient($serverpath);
至
$SOAPClient = new nusoap_client($serverpath);
我得到了哪個修正錯誤,它開始給我空白頁面。 我發現空白頁面是因為沒有安裝curl。
使用以下代碼來回顯錯誤:
$soapError = $SOAPClient->getError();
if (! empty($soapError)) {
$errorMessage = 'SOAPClient failed: ' . $soapError;
throw new Exception($errorMessage);
}
畢竟開始工作后我得到了警告:
Notice: Undefined property: nusoap_client::$operation in C:\xampplite\htdocs\newsoap\lib\nusoap.php on line 7674
我去了nusoap.php,然后我插入了這行:
if(empty($this->operation)) {
$this->operation = "";
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.