简体   繁体   中英

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.

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).

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.

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.

You need to specify the CACert option for https to work with "to" endpoint set to the https endpoint. Also use the non wsdl mode as there are some known issues with wsdl mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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