Hi Nandana,




Thanks for your help!



I checked the populateAxisService() and indeed the policy was not attached to 
the stub. After trying different solutions I decided to take the policy file 
from your tutorial, and the policy was attached to the stub! Weird considering 
that the other policy is working fine with Axis/Rampart 1.2 (please note that 
my policy was correctly attached to the binding, not the port type for the 
client stub generation). FYI the policy comes from the book "Developing Web 
Services with Apache Axis2" from Ka Lok Tong.



Now I am getting another error:



Caused by: org.apache.ws.security.WSSecurityException: An unsupported token was 
provided (An X509 certificate with version 3 must be used for SKI. The presented
 cert has version: 1)



This appears to be a known bug (https://wso2.org/jira/browse/WSAS-742), but I 
am not sure how to fix this....



Any idea? Thanks again!





Best regards,



Phil





-----Original Message-----
From: Nandana Mihindukulasooriya [mailto:[EMAIL PROTECTED]
Sent: Saturday, October 11, 2008 4:59 AM
To: [email protected]
Subject: Re: Client not signing in Rampart 1.4



Hi Phil,

   Please try using



sc.getAxisService().getPolicySubject().attachPolicy(getRampartConfiguration());



instead of the policy include. You can check the populateAxisService()

method of the generated stub to check whether policies are correctly

attached. Please use Axis2 1.4.1 instead of Axis2 1.4. Please take a

look at "Security Vulnerabilities in Apache Axis2 1.4 / Rampart 1.4

and Avoiding Them" [1].



thanks,

nandana



[1] - http://wso2.org/library/3787



On 10/11/08, Philippe Camus <[EMAIL PROTECTED]> wrote:

> Hi all,

>

> I am using Rampart 1.4 and Axis2 1.4, and trying to sign my messages. I had

> a piece of code working fine in Axis/Rampart 1.2, and I am trying to port it

> 1.4.

>

> For some reason my client won't encrypt its messages and I cannot figure out

> why..... so everything is working in clear text (I haven't configured the

> server side yet, and simply wanted to see the signed request in TcpMon).

>

> ConfigurationContext context =

> ConfigurationContextFactory.createConfigurationContextFromFileSystem("repository",

> null);

> ServiceStub service = new ServiceStub(context,

> "http://localhost:1256/axis2/services/Service?wsdl";);

> ServiceClient sc = service._getServiceClient();

> sc.engageModule("rampart");

> StAXOMBuilder builder = new StAXOMBuilder("rampart-config.xml");

> Policy rampartConfig = PolicyEngine.getPolicy(builder.getDocumentElement());

> sc.getAxisService().getPolicyInclude().addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY,

> rampartConfig);

>

> FYI, the client is generated from the WSDL containing the encryption policy

> using the "wsdl2code" ANT task.

>

> How can I debug the client side to see if the policy is correctly picked up?

> Thanks!

>

> Best regards,

>

> Phil

>

>

Reply via email to