WSF PHP client / WCF .NET webservice - [rampart][rampart_engine] Cannot create security policy from policy.

stepiens's picture

Hi Guys,

I have been trying to write PHP client that need to consume secured webservice written in .NET.

The webservice requires signing only.

the code of the client is based on the examples i found in WSF package:

<code>

$reqPayloadString = <<<XML
<ns1:Echo xmlns:ns1="http://tempuri"><text>Jak sie masz?</text></ns1:Echo>
XML;

$my_cert = ws_get_cert_from_file("./keys/my_cert.cert");
$my_key = ws_get_key_from_file("./keys/my_key.pem");
$rec_cert = ws_get_cert_from_file("./cert_server.cer");

$reqMessage = new WSMessage($reqPayloadString,
array("to"=>"http://iis-server/TestService.svc",
"action" => "Echo",
"from"=>"http://localhost/ws-security/samples/security/signing/signing_client_mod.php",
"replyTo"=>"http://localhost/ws-security/samples/security/signing/signing_client_mod.php",
"faultTo"=>"http://localhost/ws-security/samples/security/signing/signing_client_mod.php",
));


$policy_xml = file_get_contents("policy-test.xml");
$sec_token = new WSSecurityToken(array("privateKey" => $my_key,
"certificate" => $my_cert,
"receiverCertificate" => $rec_cert,
"ttl" => 300
));


$policy = new WSPolicy($policy_xml);
$client = new WSClient(array("useWSA" => TRUE,
"policy" => $policy,
"securityToken" => $sec_token));

</code>

I have checked WSF log file and it appears that there is a problem with policy file (Cannot create security policy from policy.)

[Wed Sep 05 16:57:47 2007] [info] [rampart][mod_rampart] mod_rampart initialized
[Wed Sep 05 16:57:47 2007] [info] [rampart][rampart_engine] Cannot create security policy from policy.
[Wed Sep 05 16:57:47 2007] [info] [rampart][rampart_out_handler] ramaprt_context creation failed.
[Wed Sep 05 16:57:47 2007] [info] [rampart][mod_rampart] mod_rampart shutdown

I am not sure what is causing this issue.

I attached policy file, which has been extracted from WSDL file of the target webservice

Any help really appreciated.

Thanks,

Sylwester

AttachmentSize
policy-test.xml2.55 KB
danlevan's picture

Hi, I had problems

Hi, I had problems loading the policy this way: $policy = new WSPolicy($policy_xml); But this way seems to work:  $policy_xml = file_get_contents("policy.xml"); $policy_array = array("inpolicy"=>$policy_xml, "outpolicy"=>$policy_xml); $policy = new WSPolicy(array("security" => $policy_array)); I don't know if it helps
manjula peiris's picture

Re: Cannot Create Security Policy from policy

You are trying with a Policy which has Symmetricbinding. The Current implementation does not support Symmetricbinding. We are planning to support it in the future. Thanks.
buddhika's picture

Problems in Policy

Hi Dan; Could you please send us the wsf.log file when you have the problem of loading the policy.xml file.   Thanks Buddhika 
patbeau's picture

Cannot create security policy from policy

Hi Manjula Peiris, I would like to know if SymmetricBinding is supported with the version 1.2.0? I still have the "Cannot create security policy from policy" when using the SymmetricBinding. Thanks a lot, Pat
manjula peiris's picture

Hi Pat, Sorry to say that

Hi Pat, Sorry to say that the version 1.2.0 does not support SymmetricBinding. Actually it is implmented in WSF/C , but we need some time to add these features to WSF/PHP. We are in the process of testing the implmentation (interop testing) and fixing some of the issues. The next release will surely have SymmetricBinding support. We will let you know when the issues are fixed, so you do not need to wait till the next release. Thanks, Manjula.  
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)