SOAP身份验证问题

问题描述 投票:3回答:2

我正在尝试连接到的SOAP服务器的身份验证问题。

我需要使用这个地址来检索wsdl info qazxsw poi

当我在浏览器中输入此地址时,会询问用户名和密码。填写我的用户名和密码后,将显示WSLD XML。

所以,我正在使用这个PHP代码的和平

https://profitweb.afasonline.nl/profitservices/updateconnector.asmx?wsdl

但后来我收到以下错误:

$wsdl = "https://profitweb.afasonline.nl/profitservices/updateconnector.asmx?wsdl";
$url = "https://profitweb.afasonline.nl/profitservices/updateconnector.asmx";
$login = 'username';
$password = 'password';

$client = new SoapClient( $wsdl, array('login' => $login, 'password' => $password));

这看起来不像是身份验证错误。但是,如果我手动下载wsdl文件,将其保存在本地,然后使用该文件创建Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://profitweb.afasonline.nl/profitservices/updateconnector.asmx?wsdl' : failed to load external entity "https://profitweb.afasonline.nl/profitservices/updateconnector.asmx?wsdl" in C:\xampp\htdocs\test.nl\soap.php:8 Stack trace: #0 C:\xampp\htdocs\test.nl\soap.php(8): SoapClient->SoapClient('https://profitw...', Array) #1 {main} thrown in C:\xampp\htdocs\test.nl\soap.php on line 8 ,我在初始化SoapClient时没有收到任何错误。

但如果我再提出要求

new SoapClient

我得到了这个__getLastResponseHeaders

$client->__doRequest($request, $url, 'Execute', '1');

所以这让我觉得我遇到了身份验证问题!阅读了很多关于这个问题的帖子,但找不到合适的答案喷射!

编辑将此添加到选项中

HTTP/1.1 401 Unauthorized ( The server requires authorization to fulfill the request. Access to the Web server is denied. Contact the server administrator. ) WWW-Authenticate: Negotiate WWW-Authenticate: Kerberos WWW-Authenticate: NTLM Connection: Keep-Alive Pragma: no-cache Cache-Control: no-cache Content-Type: text/html Content-Length: 3184

给我的确是一个身份验证错误。

'trace' => 1, 'exceptions' => 0
php authentication soap afas-online
2个回答
1
投票

AFAS仍然使用NuSOAP(4.x)而不是SOAP(5.x)。我正在使用可以在Github上找到的noiselabs / nusoap-bundle来访问AFAS。


1
投票

当您使用PHP中的Afasonline Soap API连接时,基本上会出现这些错误

以下是如何连接和请求的示例

注意:首先,您需要在连接之前了解有关Afasonline API的一些概念,因为您知道Afasonline使用Nusoap和Windows NTLM身份验证,因此为了连接您需要NTLM的域名,如果是Afasonline,则为“AOL”。您可以通过互联网搜索更多关于NTLM的信息。此外,您还需要以下参数才能连接environmentId(它始终以OXXXXXXX开头),userId,Password,connectorID。

我将展示带有connectorID(SSS_werkgever_vacatures)的Getconnector的示例来获取所有作业,但所有连接器的身份验证方法都相同。

Warning: SoapClient::SoapClient(https://profitweb.afasonline.nl/profitservices/updateconnector.asmx?wsdl): failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized ( The server requires authorization to fulfill the request. Access to the Web server is denied. Cont in C:\xampp\htdocs\test.nl\soap.php on line 9

© www.soinside.com 2019 - 2024. All rights reserved.