【发布时间】:2011-06-02 09:57:25
【问题描述】:
短版
我想扩展 SoapClient 以便在访问 WSDL 时在内部执行此操作:
curl -L -E /location/of/cert.pem -c /tmp/location/of/cookie.jar https://web-service-provider/servicename?wsdl
加长版
我有一个类似这样的 SOAP 请求:
$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);
如您所见,除了代理位之外,一切都非常标准。
代理原因
我编写代理来满足 Web 服务提供商的要求,即所有端点(包括 WSDL)都通过称为 siteminder 的身份验证系统进行处理。
proxy的功能很简单,如果用linux命令行curl写成这样:
curl -L -E /location/of/cert.pem -c /tmp/location/of/cookie.jar https://web-service-provider/servicename?wsdl
准确地说:
* Follow all redirections
* specify location of .pem file (and password)
* specify location of cookie jar
这一切都很好:)
但是最近服务提供商决定更改它的 WSDL。
它现在导入模式文件 (.xsd),这并没有那么糟糕,只是它与 WSDL 相关。
相对于 WSDL 文件意味着 SoapClient 解析器现在从代理的位置查找模式文件。错误,找不到!
关于这个问题的更多细节在这里:
php SoapClient fails when passed a wsdl with relative path schemas
所以我的问题是:
我怎样才能重写SoapClient(当然是通过扩展它),以仍然通过站点管理员身份验证,但不必通过那个额外的代理?
我最初的想法是,我必须以某种方式重写 URI 访问器函数(如果存在的话),但在这方面没有太多文档,我不知道从哪里开始。
或者,我可能不得不以某种方式破解SoapServer。
如果我能得到任何帮助,我将不胜感激,包括指向 SoapClient 内部的任何文档的指针。
【问题讨论】:
标签: php soap-client ntlm siteminder soapserver