【发布时间】:2021-05-01 10:43:42
【问题描述】:
我目前正在开发一个支付网关,该网关必须将订单发送到 Navision 进行管理。在 web 服务中启用了NTML 身份验证,因此首先需要扩展本机类SoapClient。为此,我在网络https://thomas.rabaix.net/articles/using-soap-php-with-ntlm-authentication 中找到了足够的文档,可以扩展这个原生类。
现在该帖子中公开的代码不会首先返回xslm。
在这种情况下,这将是我的代码
define("USERPWD", "user:password");
require_once("NTLMStream.php");
require_once("NTLMSoapClient.php");
stream_wrapper_unregister('http');
stream_wrapper_register('http', 'NTLMStream') or die("Failed to register protocol");
// Initialize Soap Client
$url = "http://ipaddress:port/DynamicsNAV1_test/WS/enterprise/Codeunit/SalesEnterprise?WSDL";
$uri = "urn:microsoft-dynamics-schemas/codeunit/SalesEnterprise";
$params = [
'stream_context' => stream_context_create([
'ssl' => [
'verify_peer'=>false,
'verify_peer_name'=>false,
'allow_self_signed'=>true,
]]),
'cache_wsdl'=> WSDL_CACHE_NONE,
'trace' => 1,
];
$client = new NTLMSoapClient($url, $params);
stream_wrapper_restore('http');
如您所见,我已经省略了作者用来定义凭据的类。
最终代码返回如下错误:
SOAP Fault: (faultcode: WSDL, faultstring: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ipaddress:port/DynamicsNAV1_test/WS/Enterprise/Codeunit/SalesEnterprise?WSDL' : Document is empty).
如果需要,我很乐意提供更多信息。非常感谢!
【问题讨论】:
-
你可以在这里看看我的回答:stackoverflow.com/a/68823338/10030693
标签: php iis soap-client