gpt4 book ai didi

php - 使用 .net 和 nusoap 的 Web 服务

转载 作者:可可西里 更新时间:2023-11-01 01:09:10 25 4
gpt4 key购买 nike

我正在使用 nusoap 连接到 .net 服务,但我在第 54 行收到错误消息“注意: undefined variable :C:\xampplite\htdocs\newsoap\searchwwcc.php 中的 HEADER

fatal error :未捕获的 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 = "";
}

关于php - 使用 .net 和 nusoap 的 Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5033769/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com