如何解决SOAP - PHP - 使用用户名/密码和证书登录
我尝试创建一个 SOAP PHP 脚本,但我遇到了问题。 我有凭据和证书 x509。
$wsdl = 'https://e-licitatie.ro:8883/pub?wsdl';
$client = new SoapClient($wsdl,array(
'local_cert' => 'cert.p12','soap_version' => SOAP_1_2,'Username' => 'xxxx','Password'=>'xxxx','trace' => 1,));
我收到此错误:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://e-licitatie.ro:8883/pub?wsdl' : Failed to load external entity "https://e-licitatie.ro:8883/pub?wsdl" in /home/adisonro/seap.adison.ro/index.PHP:10 Stack trace: #0 /home/adisonro/seap.adison.ro/index.PHP(10): SoapClient->SoapClient('https://e-licit...',Array) #1 {main} thrown in /home/adisonro/seap.adison.ro/index.PHP on line 10
我尝试了另一个具有相同结果的脚本。
$config['wsdl'] = 'https://e-licitatie.ro:8883/pub?wsdl';
$config['namespace'] = 'https://e-licitatie.ro:8883/pub';
$config['soap_options'] = array(
// 'soap_version'=>SOAP_1_2,'exceptions'=>true,'trace'=>1,'cache_wsdl'=>WSDL_CACHE_NONE
);
$credentials = (object)array('Username' => 'xxxx','Password' => 'xxxx');
$auth_object = new SoapVar($credentials,SOAP_ENC_OBJECT);
$header = new SoapHeader($config['namespace'],"SeapUserCredentials",$auth_object);
$client = new SoapClient($config['wsdl'],$config['soap_options']);
在文档中我有这个 XML,但我不明白它是如何工作的:
<soapenv:Header>
<SeapUserCredentials xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org">
<Password
xmlns=“http://schemas.datacontract.org/2004/07/SICAP.Service.Integration">password</Password>
<Username
xmlns=“http://schemas.datacontract.org/2004/07/SICAP.Service.Integration">username</Username>
</SeapUserCredentials>
</soapenv:Header>
谢谢!!!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。