gpt4 book ai didi

php - SOAP 错误客户端 : Parsing WSDL with authentication error

转载 作者:太空宇宙 更新时间:2023-11-03 13:04:25 25 4
gpt4 key购买 nike

我尝试编写我的 PHP 客户端 Soap,它使用 ASP.Net web 服务,并通过身份验证进行保护。我的 PHP 代码是:

<?php
ini_set("soap.wsdl_cache_enabled", "0");
try {
$client = new SoapClient("https://www.webservicexxx.com:60443/service.asmx?WSDL", array('location' => 'https://webservicexxxcom:60443/service.asmx',
'login' => "myLogin", 'password' => "myPAssword"));
} catch (SoapFault $e) {
echo $e;
}?>

我收到此错误消息:

 SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://www.webservicexxx.com:60443/service.asmx?WSDL' : failed to load external entity "https://www.webservicexx.com:60443/service.asmx?WSDL" in /var/www/webservice2/soap-client.php:5 Stack trace: #0 /var/www/webservice2/soap-client.php(5): SoapClient->SoapClient('https://www.web...', Array) #1 {main}

知道我在 ubuntu 服务器上的 php.ini 上设置了启用此扩展:

extension = php_openssl.dll
extension = php_soap.dll
extension = php_curl.dll

当我尝试在同一台服务器上使用身份验证解析另一个 php web 服务时,它起作用了:

try { 
$client = new SoapClient("https://xx.xx.xx.xx:443/webservice1/notificationManager.wsdl", array('location' => 'http://xx.xx.xx.xx./webservice1/soap-server.php',
'login' => "myLogin", 'password' => "myPass"));
} catch (SoapFault $exception) {
echo $exception;
}

为什么我无法收到第一个网络服务的响应?

最佳答案

我使用 nusoap 解决了这个问题.

$params = array(
"param" => "value"
);

$soap_client = new nusoap_client($wsdl_url, true);
$soap_client->setCredentials(USER_SERVICE, PASS_SERVICE, 'basic');
$soap_client->soap_defencoding = 'UTF-8'; //Fix encode erro, if you need
$soap_return = $soap_client->call("method_name", $params);

关于php - SOAP 错误客户端 : Parsing WSDL with authentication error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13194375/

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