簡體   English   中英

PHP:SOAP請求的證書鏈

[英]PHP: certificate chain for SOAP request

我有如下示例的SOAP請求消息,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v="http://incometaxindiaefiling.gov.in/ws/ds/common/v_1_0">
<soapenv:Header/>
<soapenv:Body>
<v:DITWSAuthInfoEle>
<v:userID>xxxxxxxxxx</v:userID>
<v:password>xxxxxxxxxx</v:password>
<v:certChain>xxxxxxxxxx</v:certChain>
<v:signature>xxxxxxxxxx</v:signature>
</v:DITWSAuthInfoEle>
</soapenv:Body>
</soapenv:Envelope>

我得到了身份驗證詳細信息和xyz.pfx文件。 通過使用此文件,我獲得了XML簽名表示並將其添加到SOAP請求中。 在這里,我的問題是如何獲取certChain(證書鏈)以及如何將其添加到SOAP請求中。 有人可以幫助我嗎?

使用SoapClient ,默認情況下會驗證服務器證書,您可以發送如下客戶端證書:

$protected_url = "https://my-server/?wsdl";
$my_cert_file = "/my/path/to/mycert.pem";

$client = new SoapClient($protected_url, array('local_cert', $my_cert_file) );

或者,如果您的證書要求密碼:

$client = new SoapClient("https://url.to.service/", array(
        'local_cert' => 'client_certificate.pem', 'passphrase' => 'PASSPHRASE',
        'cache_wsdl' => WSDL_CACHE_NONE
));

然后,如果要查看xml,可以使用__getLastRequest

還要檢查有關如何在PHP上將SOAP與證書一起使用的詳細答案:

使用證書創建PHP SOAP請求

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM