扩展php SoapClient进行siteminder身份验证 [英] Extending php SoapClient for siteminder authentication

查看:106
本文介绍了扩展php SoapClient进行siteminder身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想扩展SoapClient,以便在访问WSDL时在内部执行此操作:

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

长版

我有一个与此类似的SOAP请求:

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.

代理的原因

我编写代理是为了满足Web服务提供商的要求,即所有包括WSDL的端点都必须通过称为siteminder的身份验证系统进行处理.

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.

代理的功能非常简单,如果用linux命令行curl编写,将是这样的:

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

准确地说:

* Follow all redirections
* specify location of .pem file (and password)
* specify location of cookie jar

这一切都很好:)

最近,服务提供商决定更改其WSDL.

BUT recently the service provider decided to changes it's WSDL.

现在它可以导入架构文件(.xsd),除了相对于WSDL而言,还不错.

It now imports schema files (.xsd), which is not all that bad, except it is relative to the WSDL.

相对于WSDL文件,这意味着SoapClient解析器现在从代理位置查找模式文件.错误,找不到!

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在通过wsdl时失败相对路径模式

所以我的问题是:

我该如何重写SoapClient(当然要通过扩展它),以仍然通过siteminder身份验证,而不必通过该额外的代理服务器?

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?

我最初的想法是,我必须以某种方式重写URI访问器函数(如果存在),但是在该领域没有太多文档说明,我不确定从哪里开始.

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.

或者,我可能不得不以某种方式破解SoapServer.

Alternatively, I might have to hack SoapServer somehow.

我将不胜感激,包括对SoapClient内部的任何文档的指向.

I would appreciate any help I can get, including pointers to any documentation into the internals of SoapClient.

推荐答案

有关此头抓挠,拉毛问题的答案可在以下位置找到:

The answer to this head scratching, hair pulling problem can be found here:

http://rabaix. net/zh-CN/articles/2008/03/13/using-soap-php-with-ntlm-authentication .

感谢php soap邮件列表中的Jeffery Fernandez指出了这一点.

Thanks to Jeffery Fernandez on the php soap mailing list who pointed this out.

这篇关于扩展php SoapClient进行siteminder身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆