php-通过HTTPS的SOAP Client(两端均带有SSL证书)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php-通过HTTPS的SOAP Client(两端均带有SSL证书),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2593字,纯文字阅读大概需要4分钟。
内容图文
我必须开发一个SOAP客户端,供应商向我发送以下规范:
>将通过IP使用HTTPS进行传输,并将打包为XML文档,以适应XML方案的不同定义.
>通信是同步的,第三方应等待响应.
>每个请求和响应都将被签名.
我正在使用PHP中的soapClient类,并且一切正常,除非我尝试使用私钥与服务器建立通信:
Code: WSDL | Message: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://remoteserver/CustomerManagementService?wsdl' : failed to load external entity "https://remoteserver/CustomerManagementService?wsdl
然后,我尝试创建一个.pem文件,该文件包含我的私钥与证书并置,如我所读:how to send SOAP request with SSL certificate in PHP?
但是它仍然返回错误:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://remoteserver:80/CustomerManager/proxy/CustomerManagementService?WSDL%2FGWTCommonResources%2Fwsdl%2FGWTCommonMessages' : failed to load external entity "http://remoteserver:80/CustomerManager/proxy/CustomerManagementService?WSDL%2FGWTCommonResources%2Fwsdl%2FGWTCommonMessages
我想知道是否有某种方法可以确切地获取PHP的soapClient类发送的原始数据.以及我必须设置供应商证书的位置.
我已经尝试过使用“ $client-> __ getLastRequest()”,但是得到的是NULL.这是我的代码:
$client = new anotherSoapClient($service, array(
'local_cert' => $pem,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED,
'soap_version' => SOAP_1_2,
'authentication'=> SOAP_AUTHENTICATION_DIGEST,
'ssl' => array(
'ciphers'=> "SHA1",
'verify_peer' => false,
'allow_self_signed' => true
),
'https' => array(
'curl_verify_ssl_peer' => false,
'curl_verify_ssl_host' => false
),
'cache_wsdl' => WSDL_CACHE_NONE,
'cache_ttl' => 86400,
'trace' => true,
'exceptions' => true,
));
// Test connection
echo BR.'Functions: <pre>';var_dump($client->__getFunctions());echo '</pre>';
$XMLrequest = $client->prepareRequest($email);
$response = $client->__anotherRequest('getCustomerInfo', $XMLrequest);
echo "REQUEST:\n" . $client->__getLastRequest() . "\n";
顺便说一句,我在本地计算机上使用PHP 5.4.9,并且服务器具有PHP 5.3.10,anotherSoapClient是扩展PHP soapClient类的类:PHP soapClient send custom XML
解决方法:
对于调试建议,您的SOAP请求必须扩展SoapClient类.
class SoapClientDebug extends SoapClient
{
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
// Add code to inspect/dissect/debug/adjust the XML given in $request here
// Uncomment the following line, if you actually want to do the request
// return parent::__doRequest($request, $location, $action, $version, $one_way);
}
}
然后在您的请求中使用它:
$client = new SoapClientDebug("x.wsdl");
$response = $client->__soapCall($function);
echo $client->__getLastRequest();
希望它有助于调试您的代码!
内容总结
以上是互联网集市为您收集整理的php-通过HTTPS的SOAP Client(两端均带有SSL证书)全部内容,希望文章能够帮你解决php-通过HTTPS的SOAP Client(两端均带有SSL证书)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。