简体   繁体   English

WSO2 WSF / PHP-具有WS-Security证书签名的WSDL

[英]WSO2 WSF/PHP - WSDL w WS-Security Certificate Signing

I am trying to connect to a WSDL that uses WS-Security Certificate Signing over HTTPS. 我正在尝试连接到通过HTTPS使用WS-Security证书签名的WSDL。

Only the outgoing messages are signed and it uses Binary Security Token (could not find this specific option in WSO2 but so I am unsure I am using the correct option in the code below). 仅外发邮件经过签名,并且使用二进制安全令牌(在WSO2中找不到此特定选项,但是我不确定我在下面的代码中使用了正确的选项)。

I have looked at the code in the Samples of the WSO2 WSF/PHP and have joined together the WDSL client example and the Signing example. 我查看了WSO2 WSF / PHP样本中的代码,并将WDSL客户端示例和Signing示例结合在一起。

Code: 码:

$my_cert = ws_get_cert_from_file("./keys/cert.pem");
$my_key = ws_get_key_from_file("./keys/key.pem");

$sec_array = array("sign"=>TRUE,
                   "algorithmSuite" => "Basic256Rsa15",
                   "securityTokenReference" => "EmbeddedToken");  //Is this correct for Binary Security Token?

$policy = new WSPolicy(array("security"=>$sec_array));

$sec_token = new WSSecurityToken(array("privateKey" => $my_key,
                                       "certificate" => $my_cert));

$client = new WSClient(array("wsdl"=>"https://.../Informationservice.WSDL",
                             "useWSA" => TRUE,
                             "policy" => $policy,
                             "securityToken" => $sec_token));

$proxy = $client->getProxy();   

$return_val =  $proxy->StreetTypes();

Any help would be much appreciated as I haven't been able to find an examples of connecting to a service like this online anywhere. 非常感谢您的帮助,因为我无法在任何地方在线找到连接到此类服务的示例。 Most services seem to sign with Username and Password rather than Certificates and when looking for WSDL and Certificate Signing I don't find anything at all. 大多数服务似乎使用用户名和密码而不是证书进行签名,并且在查找WSDL和证书签名时我什么都没找到。

You need to specify the CACert option for https to work with "to" endpoint set to the https endpoint. 您需要为https指定CACert选项,以将“ to”端点设置为https端点。 Also use the non wsdl mode as there are some known issues with wsdl mode. 还请使用非wsdl模式,因为wsdl模式存在一些已知问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM