Php HTTP上的SOAP客户端,两侧都有SSL证书
我必须开发SOAP客户端,供应商向我发送以下规范:Php HTTP上的SOAP客户端,两侧都有SSL证书,php,web-services,soap,ssl,soap-client,Php,Web Services,Soap,Ssl,Soap Client,我必须开发SOAP客户端,供应商向我发送以下规范: 将通过IP使用HTTPS传输,并将打包为XML文档,以适应XML方案的不同定义 通信是同步的,第三方应等待响应 每个请求和响应都将被签名 我使用的是PHP中的soapClient类,除了尝试使用私钥建立与服务器的通信外,所有这些都可以正常工作: Code: WSDL | Message: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://remoteserver/CustomerMa
- 将通过IP使用HTTPS传输,并将打包为XML文档,以适应XML方案的不同定义
- 通信是同步的,第三方应等待响应
- 每个请求和响应都将被签名
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文件,它包含我的私钥和我的证书,正如我在中读到的:
但它仍然返回一个错误:
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->\uu getLastRequest()”,但得到的是空值。这是我的代码:
$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";
$client=新的另一个soapclient($service,array)(
“本地证书”=>$pem,
'style'=>SOAP\u RPC,
“使用”=>SOAP\u编码,
“soap_版本”=>soap_1_2,
“身份验证”=>SOAP\u身份验证\u摘要,
“ssl”=>数组(
“密码”=>“SHA1”,
“验证对等方”=>false,
“允许自签名”=>true
),
'https'=>数组(
'curl\u verify\u ssl\u peer'=>false,
'curl\u verify\u ssl\u host'=>false
),
'cache\u wsdl'=>wsdl\u cache\u NONE,
'cache_ttl'=>86400,
'trace'=>true,
“例外情况”=>true,
));
//测试连接
echo BR.“函数:”;var_dump($client->_getFunctions());回声';
$defaultEndpoint = "https://remoteserver/CustomerManagementService";
$uri = "https://remoteserver";
$client = new anotherSoapClient($service, array(
'local_cert' => $pem,
'location' => $defaultEndpoint,
'uri' => $uri,
'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,
));
$XMLrequest=$client->prepareRequest($email);
$response=$client->\u另一个请求('getCustomerInfo',$XMLrequest);
回显“请求:\n”$客户端->\uuu getLastRequest()。“\n”;
顺便说一下,我在本地机器上使用的是PHP 5.4.9,服务器上有PHP 5.3.10,另一个soapClient是扩展PHP soapClient类的类:您可能需要指定以下SoalClient选项:
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);
}
}
您可能需要指定以下SoalClient选项:
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);
}
}
您可能需要指定以下SoalClient选项:
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);
}
}
您可能需要指定以下SoalClient选项:
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);
}
}
为了调试SOAP请求,必须扩展SoapClient类
$client = new SoapClientDebug("x.wsdl");
$response = $client->__soapCall($function);
echo $client->__getLastRequest();
然后在您的请求中使用它:
希望它有助于调试您的代码 要调试SOAP请求,您必须扩展SoapClient类
$client = new SoapClientDebug("x.wsdl");
$response = $client->__soapCall($function);
echo $client->__getLastRequest();
然后在您的请求中使用它:
希望它有助于调试您的代码 要调试SOAP请求,您必须扩展SoapClient类
$client = new SoapClientDebug("x.wsdl");
$response = $client->__soapCall($function);
echo $client->__getLastRequest();
然后在您的请求中使用它:
希望它有助于调试您的代码 要调试SOAP请求,您必须扩展SoapClient类
$client = new SoapClientDebug("x.wsdl");
$response = $client->__soapCall($function);
echo $client->__getLastRequest();
然后在您的请求中使用它:
希望它有助于调试您的代码