SOAP Client over HTTPS with SSL certificates on both sides

╄→尐↘猪︶ㄣ 提交于 2019-12-01 14:27:32

For debugging proposals your SOAP request you have to extend the SoapClient class.

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);
      }
    }

And next use it in your request:

$client = new SoapClientDebug("x.wsdl");
        $response = $client->__soapCall($function);
        echo $client->__getLastRequest();

Hope it helps to debug your code!

You probably need to specify following SoalClient options:

$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,
));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!