Published on WSO2 Oxygen Tank (http://wso2.org)

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

By stepiens
Created 2007-09-05 08:08

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


Source URL:
http://wso2.org/forum/thread/2609