使用HTTPS webservice和.PEM客户端证书的PHP SOAP
如何使用HTTPS webservice和.PEM客户端证书创建PHP SOAP?使用HTTPS webservice和.PEM客户端证书的PHP SOAP
当我这样做,我收到了如下错误:
array(2) { [0]=> string(38) "testeResponse teste(teste $parameters)" [1]=> string(38) "testeResponse teste(teste $parameters)" }
Fatal error: Uncaught SoapFault exception: [wsse:InvalidSecurity] SOAP header missing in D:\Inetpub\wwwroot\SOAP\index.php:47 Stack trace: #0 [internal function]: SoapClient->__call('teste', Array) #1 D:\Inetpub\wwwroot\SOAP\index.php(47): SoapClient->teste(Array) #2 {main} thrown in D:\Inetpub\wwwroot\SOAP\index.php on line 47
代码:
$client = new SoapClient($wsdl, array(    'local_cert' => $localCert, 
    'passphrase' => $passphrase, 
    'style'  => SOAP_DOCUMENT, 
    'use'  => SOAP_LITERAL, 
    'exceptions' => true, 
    'trace'  => true) 
); 
$something = $client->teste(array()); 
echo $something->testeResult; 
回答:
的警告并非是对PEM证书或SSL。它很简单:
SOAP header missing
您找到SOAPHeader in the PHP manual。 PHP手册中也有一些使用示例和用户贡献的注释,也在本网站上。例如:
$auth = array(    'UserName' => 'USERNAME', 
    'Password' => 'PASSWORD', 
    'SystemId' => array('_'=> 'DATA', 'Param' => 'PARAM'), 
); 
$header = new SoapHeader('NAMESPACE','Auth',$auth,false); 
$client->__setSoapHeaders($header); 
让我知道你是否遇到问题。
以上是 使用HTTPS webservice和.PEM客户端证书的PHP SOAP 的全部内容, 来源链接: utcz.com/qa/259736.html








