Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7438305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:32:00+00:00 2026-05-29T10:32:00+00:00

I have been struggling with a problem I have with Axis2 and Rampart for

  • 0

I have been struggling with a problem I have with Axis2 and Rampart for a few hours. I have googled quite extensively and have yet to find a solution. I have even looked at the source code and stepped through it with a debugger. Though this has enlightened me about the error and its cause it has not brought me closer to a solution.

The error that is occurring is

java.lang.IllegalArgumentException: {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}ProtectionToken is not a <wsp:Policy> element.
    at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:177)
    at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:125)
    at org.apache.neethi.PolicyEngine.getPolicy(PolicyEngine.java:102)
    at org.apache.ws.secpolicy11.builders.SymmetricBindingBuilder.build(SymmetricBindingBuilder.java:41)
    at org.apache.ws.secpolicy11.builders.SymmetricBindingBuilder.build(SymmetricBindingBuilder.java:36)
    at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:129)
    at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:110)
    at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:225)
    at org.apache.neethi.PolicyBuilder.getAllOperator(PolicyBuilder.java:185)
    at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:218)
    at org.apache.neethi.PolicyBuilder.getExactlyOneOperator(PolicyBuilder.java:181)
    at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:216)
    at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:175)
    at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:114)
    at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:100)
    at org.apache.neethi.PolicyEngine.getPolicy(PolicyEngine.java:80)
    at com.geometryit.blis.ablis.contentManagement.ContentManagementServiceStub.getPolicy(ContentManagementServiceStub.java:413)
    at com.geometryit.blis.ablis.contentManagement.ContentManagementServiceStub.populateAxisService(ContentManagementServiceStub.java:57)
    at com.geometryit.blis.ablis.contentManagement.ContentManagementServiceStub.<init>(ContentManagementServiceStub.java:108)
    at com.geometryit.blis.ablis.contentManagement.ContentManagementServiceStub.<init>(ContentManagementServiceStub.java:97)
    at com.geometryit.blis.production.Publish.init(Publish.java:214)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1133)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1087)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:996)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4834)
    at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5155)
    at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5150)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

While I have used Axis2 before, I’m no expert with it and even less so with Rampart. I had an existing Web App that has been extended to introduce a client for a Web Service interaction. I installed Axis2 v1.6.1 and Rampart v1.6.1 as instructed. I built the client-side Java classes using the WSDL2Java script and bundled the generated classes into a jar. I then added the appropriate jars and Axis2 repository to the Web App. The WSDL and XSDs are contained in the wsdl.zip attachment of http://mail-archives.apache.org/mod_mbox/axis-java-user/201112.mbox/%3C4B95BC7335A13A42AD0D23462F91AE6F615D057F41%40echo.geometryit.com%3E
(Axis2 User Mailing List) The atachments are at the bottom of the page.

The section of code that initialises the client-side of the web service is

try
{
  ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(this.getWebInfPath() + "repository" );

**ablisContentManagementService = new ContentManagementServiceStub( context, "http://services.ablis.uat.business.gov.au/ContentManagement.svc" );

  ServiceClient ablisContentManagementServiceClient = ablisContentManagementService._getServiceClient();

  ablisContentManagementServiceClient.engageModule( "addressing" );
  ablisContentManagementServiceClient.engageModule( "rampart" );

  ablisAxisFault = null;
}
catch ( AxisFault af )
{
  ablisContentManagementService = null;
  ablisAxisFault = af;
  af.printStackTrace();
}
catch ( Throwable t )
{
  t.printStackTrace();
}

I know that Rampart is not configured properly but the error is being thrown at the highlighted line (**). This is before where the Rampart configuration would occur, if done.

In debugging, I noticed that the XML, as an OMElement instance, being passed to the SymmetricBindingBuilder.build() (see stacktrace) is (cut down for brevity)

<wsp:Policy>
  <sp:ProtectionToken>
    .
    .
    .
  </sp:ProtectionToken>
  .
  .
  .
</wsp:Policy>

From the code in SymmetricBindingBuilder.build(), I think the XML should be:

<sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
  <wsp:Policy>
    <sp:ProtectionToken>
      .
      .
      .
    </sp:ProtectionToken>
    .
    .
    .
  </wsp:Policy>
</sp:SymmetricBinding>

A change to the XML being passed would fix the error but how to accomplish this.

I may have made errors or omissions in what I have said or done in order to be brief. If important details are missing, please highlight these. I’m familiar with Axis2 and not at all with Rampart so any help is appreciated. I am happy to answer questions. Any help is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:32:00+00:00Added an answer on May 29, 2026 at 10:32 am

    I’m guessing you’re already past this issue. But it’s a fresh, raw, itchy wound for me. After many hours of struggling with almost the exact same issue, I finally found a solution.

    In the generated client code, eg ClientStub, there’s a static getPolicy() function that needs to be adjusted from this (whitespace adjusted for readability):

    private static org.apache.neethi.Policy getPolicy (java.lang.String policyString) 
    {
      java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(policyString.getBytes());
      return org.apache.neethi.PolicyEngine.getPolicy(bais);
    }
    

    To this:

    private static org.apache.neethi.Policy getPolicy (java.lang.String policyString) 
    {
      java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(policyString.getBytes());
      try 
      {
        StAXOMBuilder builder = new StAXOMBuilder(bais);
        OMElement documentElement = builder.getDocumentElement();
        return org.apache.neethi.PolicyEngine.getPolicy(documentElement);
      } 
      catch (XMLStreamException e) 
      {
        e.printStackTrace();
      }
      return null;
    }
    

    I ran across this solution in this mail thread.

    . Topher

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling to find a solution to this problem. In my code,
I have been struggling with this problem for the last few hours, and it
I have been struggling for a few days trying to find out how come
I have been struggling with this problem for a few days now and I
I have been struggling with this seeminly easy problem for 48 hours, and I
I have a problem that I have been struggling with for a few days
I have been struggling for several hours about this problem, although it seems ridiculous
I have been struggling with a problem in the past few days. I really
I have a problem I have been struggling with for quite a while now
I've been struggling with Zend_Navigation all weekend, and now I have another problem, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.