aspose file tools*
The moose likes Web Services and the fly likes Policy is not a <wsp:Policy> element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Policy is not a <wsp:Policy> element" Watch "Policy is not a <wsp:Policy> element" New topic
Author

Policy is not a <wsp:Policy> element

Ravinderjit Singh
Ranch Hand

Joined: Jan 13, 2010
Posts: 68
Hello,

Working with Axis2 1.6.2.
I am trying to invoke Axis2 service using java client. Using ServiceClient for invoke. Modules engaged 'Addressing' and 'Rampoart'.

Attached here my policy file.

I am getting this error.

INFO [main] (ModuleDeployer.java:82) - Deploying module: addressing-1.6.2 - file:/C:/Workspaces/Eclipse_Workspace/Axis2HelloService/src/resources/modules/addressing-1.6.2.mar
INFO [main] (ModuleDeployer.java:82) - Deploying module: rahas-1.6.2 - file:/C:/Workspaces/Eclipse_Workspace/Axis2HelloService/src/resources/modules/rahas-1.6.2.mar
INFO [main] (ModuleDeployer.java:82) - Deploying module: rampart-1.6.2 - file:/C:/Workspaces/Eclipse_Workspace/Axis2HelloService/src/resources/modules/rampart-1.6.2.mar
Exception in thread "main" java.lang.IllegalArgumentException: {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Policy is not a <wsp:Policy> element.
at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:176)
at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124)
at org.apache.neethi.PolicyEngine.getPolicy(PolicyEngine.java:100)
at org.apache.ws.secpolicy11.builders.WSS10Builder.build(WSS10Builder.java:40)
at org.apache.ws.secpolicy11.builders.WSS10Builder.build(WSS10Builder.java:33)
at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:138)
at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224)
at org.apache.neethi.PolicyBuilder.getAllOperator(PolicyBuilder.java:184)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:217)
at org.apache.neethi.PolicyBuilder.getExactlyOneOperator(PolicyBuilder.java:180)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:215)
at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174)
at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124)
at org.apache.neethi.PolicyEngine.getPolicy(PolicyEngine.java:100)
at com.example.axis2.RampartSampleClient.loadPolicy(RampartSampleClient.java:93)
at com.example.axis2.RampartSampleClient.main(RampartSampleClient.java:53)


Loading the policy like this
StAXOMBuilder builder = new StAXOMBuilder(filePath);
return PolicyEngine.getPolicy(builder.getDocumentElement());

This is my policy.



Same client used to work with Axis2 1.5.6

Thanks for your help.
surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

Can you provide us archive with whole project files?
Ravinderjit Singh
Ranch Hand

Joined: Jan 13, 2010
Posts: 68
Can't upload .zip/.rar files here. You can download from here
You may need to adjust the build path.
Ravinderjit Singh
Ranch Hand

Joined: Jan 13, 2010
Posts: 68
Hi Surlac,

Do you have any comments on this problem ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Policy is not a <wsp:Policy> element
 
Similar Threads
Axis 2 & Rampart - Only apply security to outbound requests.
Exception in thread "main" org.apache.axis2.AxisFault: Error in extracting message properties
SOAP Header missing using (Hash values do not match ) Rampart/Axis2
Axis 2 & Rampart - Missing Security Header
Problem with MTOM attachment in secured WS