Short Version
I want to extend SoapClient
so it does this internally when accessing the WSDL:
curl -L -E /location/of/cert.pem -c /tmp/location/of/cookie.jar https://web-service-provider/servicename?wsdl
Long Version
I've got a SOAP request similar to this:
$serviceUrl = 'https://service-url';
$wsdl = $serviceUrl . '?wsdl';
$proxyServiceUrl = 'http://localhost/myproxy.php?url=$serviceUrl';
$proxyWsdl = 'http://localhost/myproxy.php?url=$wsdl';
$options = array(
'cache_wsdl' => WSDL_CACHE_NONE,
'encoding' => 'utf-8',
'soap_version' => SOAP_1_1,
'exceptions' => true,
'trace' => true,
'location' => $proxyServiceUrl
);
$client = new SoapClient($proxyWsdl, $options);
$params = array( /* */ );
$client->someOperation($params);
As you can see, everything is pretty standard except for the proxy bit.
Reason for the proxy
I wrote the proxy to fulfill a requirement by the web service provider that all end-points including the WSDL be processed through an authentication system called siteminder.
The function of the proxy is quite straight forward, if written in linux command line curl it would be something like this:
curl -L -E /location/of/cert.pem -c /tmp/location/of/cookie.jar https://web-service-provider/servicename?wsdl
To be precise:
* Follow all redirections
* specify location of .pem file (and password)
* specify location of cookie jar
This all works fine :)
BUT recently the service provider decided to changes it's WSDL.
It now imports schema files (.xsd
), which is not all that bad, except it is relative to the WSDL.
Being relative to the WSDL file means that the SoapClient
parser now looks for the schema files from the proxy's location. ERROR, can't find!
More details about that problem here:
php SoapClient fails when passed a wsdl with relative path schemas
So My Question Is:
How can I rewrite SoapClient
(By Extending it of course), to still go through the siteminder authentication but without having to go through that extra proxy?
My initial thoughts are that somehow I have to rewrite the URI accessor function (if one exists) but without much documenation in this area I'm not sure where to start.
Alternatively, I might have to hack SoapServer
somehow.
I would appreciate any help I can get, including pointers to any documentation into the internals of SoapClient
.