gpt4 book ai didi

php - SoapClient 到 nusoap,Server 没有识别 HTTP Header SOAPAction 的值

转载 作者:可可西里 更新时间:2023-11-01 00:46:20 27 4
gpt4 key购买 nike

我们正在运行 PHP 5.3.18,由于一些奇怪的原因我无法安装 php-soap,因此我无法使用 SoapClient 类...

我现在正在使用最后一个 nusoap(应该与 php 5.3.18 兼容)并翻译代码从 SoapClient 到 nusoap_client。

此代码使用 SoapClient 并完美运行

$s_WSPROTOCOL = 'https';
$s_WSHOSTNAME = 'xxxxxxxx.yyyyyy.tdl';
$s_WSPORT = '';
$s_WSPATHNAME = 'webservices/service.asp?WSDL';
$s_WSTIPOOP = 'MyFunction';

$parameters['Username'] = '999';
$parameters['Login'] = 'Master';
$parameters['Password'] = 'universe';
$parameters['IdServ'] = '5';
$parameters['IdCard'] = '555';
$parameters['Controllo'] = '';

echo $s_WSTIPOOP."<br />";
echo $s_WSPROTOCOL."://".$s_WSHOSTNAME.$s_WSPORT."/".$s_WSPATHNAME."<br /><br /><br />";

try
{
$SOAP = new SoapClient($s_WSPROTOCOL."://".$s_WSHOSTNAME.$s_WSPORT."/".$s_WSPATHNAME, array('trace' => 1));
$result = $SOAP->__soapCall($s_WSTIPOOP, array("parameters" => $parameters), null);
foreach ($result as $key => $value)
{
echo "<b>".$key."</b><br />";
print_r($value);
echo "<br />";
}

}
catch (SoapFault $e)
{
echo "<b>".$e->faultstring."</b>";
}

nusoap 中的这段代码返回

[faultcode] => soap:Client
[faultstring] => Server did not recognize the value of HTTP Header SOAPAction: .
[detail] =>

这里是代码

require("nusoap/lib/nusoap.php");

error_reporting(E_ALL ^ E_NOTICE);
$ERROR_MSG = '';

$s_WSPROTOCOL = 'https';
$s_WSHOSTNAME = 'xxxxxxxx.yyyyyy.tdl';
$s_WSPORT = '';
$s_WSPATHNAME = 'webservices/service.asp?WSDL';
$s_WSTIPOOP = 'MyFunction';

$parameters['Username'] = '999';
$parameters['Login'] = 'Master';
$parameters['Password'] = 'universe';
$parameters['IdServ'] = '5';
$parameters['IdCard'] = '555';
$parameters['Controllo'] = '';

echo $s_WSTIPOOP."<br />";
echo $s_WSPROTOCOL."://".$s_WSHOSTNAME.$s_WSPORT."/".$s_WSPATHNAME."<br /><br /><br />";
$client = new nusoap_client($s_WSPROTOCOL."://".$s_WSHOSTNAME.$s_WSPORT."/".$s_WSPATHNAME);

$result = $client->call($s_WSTIPOOP, $parameters, '');

if ($client->fault) {
echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>'; print_r($result); echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
}
}

错在哪里?我正在阅读 nusoap 源代码,尝试使用不同的参数但没有成功

最佳答案

我必须将 $wsdl 参数设置为 true 才能工作

$client = new nusoap_client($s_WSPROTOCOL."://".$s_WSHOSTNAME.$s_WSPORT."/".$s_WSPATHNAME, true);

关于php - SoapClient 到 nusoap,Server 没有识别 HTTP Header SOAPAction 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17524226/

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