Axis 2 and Rampart- why does service return wsse:Security header in request?

I'm connecting to a secure service.

I have a SOAP UI project configured to use a jks file to provide the certificate, along with appropriate security settings to allow me to get a valid response.

I've have used AXIS 2 and Rampart to create a SOAP request from a JAVA project. Using TCPMon I've managed to grab the SOAP request.

When the request runs in the JAVA project, I just get the response:

org.apache.axis2.AxisFault: Missing wsse:Security header in request

but if I take the same request, captured in TCPMon and put it in a SOAP UI project, I get a response successfully.

Anyone got any ideas?

<soapenv:Envelope xmlns:soapenv="">  <soapenv:Header>  
<wsse:Security xmlns:wsse=""  
  <wsu:Timestamp xmlns:wsu=""  
  <wsse:BinarySecurityToken xmlns:wsu=""  
  <ds:Signature xmlns:ds=""  
      <ds:CanonicalizationMethod Algorithm="" />  
      <ds:SignatureMethod Algorithm="" />  
      <ds:Reference URI="#Id-15..93">  
          <ds:Transform Algorithm="" />  
        <ds:DigestMethod Algorithm="" />  
      <ds:Reference URI="#Timestamp-1">  
          <ds:Transform Algorithm="" />  
        <ds:DigestMethod Algorithm="" />  
    <ds:KeyInfo Id="KeyId-ECD..2">  
      <wsse:SecurityTokenReference xmlns:wsu=""  
        <wsse:Reference URI="#CertId-ECDB0E..01"  
        ValueType="" />  
</wsse:Security></soapenv:Header><soapenv:Body xmlns:wsu="" wsu:Id="Id-15..3"><ns2:ProductSearchV2Request xmlns:ns2="">   

This is the WS-POLICY document that I'm using:

<?xml version="1.0" encoding="UTF-8"?>  
 ! Copyright 2006 The Apache Software Foundation.  
 ! Licensed under the Apache License, Version 2.0 (the "License");  
 ! you may not use this file except in compliance with the License.  
 ! You may obtain a copy of the License at  
 ! Unless required by applicable law or agreed to in writing, software  
 ! distributed under the License is distributed on an "AS IS" BASIS,  
 ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
 ! See the License for the specific language governing permissions and  
 ! limitations under the License.  
<wsp:Policy wsu:Id="SigOnly"  
            <sp:AsymmetricBinding xmlns:sp="">  
            <sp:Wss10 xmlns:sp="">  
            <sp:SignedParts xmlns:sp="">  
            <ramp:RampartConfig xmlns:ramp="">  

                    <ramp:crypto provider="">  
                        <ramp:property name="">JKS</ramp:property>  
                        <ramp:property name="">build\resources\qa.jks</ramp:property>  
                        <ramp:property name="">123123</ramp:property>  


Thanks Alan

It looks as if the error isn't with the outbound request, but with handling the response. The response doesn't have a security header and when we're trying to unencrypt it, an exception occurs.

I need to somehow change my Rampart configuration to only do outbound security, not inbound

I'll report back :)

Ok the problem was that once Rampart is engaged, it expects the response to have the same security header. The way I solved the problem was by removing the handler to the Inflow security in the Rampart.mar file.

I'm not sure if this is the best fix, but it worked for us.

To remove the inflow handler: Unpack the rampart.mar file

Comment out the Inflow section

Zip up the META_INF folder. Then rename the .zip file to be .mar

Now when you use this as there are no handlers defined for inflow, it will just use the standard Axis2 response handler.

I guess if you had several projects using Rampart where some had the security header in the response and some didn't you would need a different approach.

Another approach is detailed here. It's probably a better approach :


org.apache.axis2.AxisFault: Missing wsse:Security header in request at org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault( at org.apache.rampart.handler.RampartReceiver.invoke( at org.apache.axis2.engine.Phase.invoke( at org.apache.axis2.engine.AxisEngine.invoke( at org.apache.axis2.engine.AxisEngine.receive( at org.apache.axis2.description.OutInAxisOperationClient.handleResponse( at org.apache.axis2.description.OutInAxisOperationClient.send( at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(

Rampart exception when response from secured backend service , GitHub is home to over 50 million developers working together to host and Rampart exception when response from secured backend service returns HTTP 500 #4155 AxisEngine.invoke( at org.apache.axis2.​engine. RampartException: Missing wsse:Security header in request at  2 Axis 2 and Rampart- why does service return wsse:Security header in request? Jun 1 '12 1 How do I get a whole TD to be clickable when using a background in a sub div Dec 7 '18

After navigating a lot, and reading the same pages several times, I finally got a solution that satisfied me.

From previous post I Quote: "Ok the problem was that once Rampart is engaged, it expects the response to have the same security header." (as the request) This is absolutely true!

I feel that the best approach is found in the following link:

However, in my case, I didn't want to make a new module, so I decided to emulate the module in my code. I tried to explain it in three steps.

  1. (First) I used a default policy (take from the previous link), as a method in my code. (It's worked for Axis 1.6.2 and the compatible version of Rampart)

private String getPolicy() { return "xml for policy" }

Important the method must return the following xml as String (better reading)

<wsp:Policy wsu:Id="emptryPolicy" 
<sp:TransportBinding xmlns:sp=""> 
  1. (Second) I created a Policy (object) based on the previous method.

InputStream stream = new ByteArrayInputStream(getPolicy().getBytes());

Policy p = PolicyEngine.getPolicy(stream);

  1. (Third) I used the properties of KEY_RAMPART_IN_POLICY and KEY_RAMPART_OUT_POLICY.

Stub._getServiceClient().getOptions().setProperty(RampartMessageData.KEY_RAMPART_OUT_POLICY, the security policy of the web service);

Stub._getServiceClient().getOptions().setProperty(RampartMessageData.KEY_RAMPART_IN_POLICY, p);

Important The security policy of the web service, depends on the security that the web service uses... If your provider supplied the policy in the wsdl, you would not have to struggle with this... but in other cases, you just use the Rampart Policies. In the rampart site, are examples described very clear for each type of security policy. (UsernameToken Authentication, AsymmetricBinding, etc.)

This example fashions a request with security and response without security. It Works for me!

Re: "Missing wsse:Security header in request" exception., This service is based on the latest Rampart > and Axis2 SNAPSHOT version as suggested in the forum. However, when I > tried to call this  I have a web service using AXIS2 with WS-Security provided by RAMPART. I'm using OAS as application server and HTTPS for the transport protocol. The client application has a RAMPART policy that sings and encrypts data before sending the request to the server.

In my case same problem but i got success response by changing the soap request version name space uri in the stub. i have change the name space uri from "" to "".

Java Web services: Axis2 WS-Security basics, Learn how to add the Rampart security module to Apache Axis2 and start SOAP-based Web services can use widely supported WS-Security and function of sending a username and password on a service request. It uses a SOAP message-header element to attach the security return PolicyEngine. How to pass HTTP request to Web-Service. ajax,web-services,liferay,liferay-6,portlet. Suggesting to rethink your problem. A servlet request object does not make any sense as parameter for a web service call. Those are two totally different frameworks. A servlet request only makes sense within the processing of a servlet and is defined within

Advanced Reporting Guide for MicroStrategy 9. 3. 1, An additional example of using REST functions that can support both basic and For the example above, this requests data on the state of Virginia. This function uses Axis2/C to invoke web services and uses Rampart/C to support WS-Security SoapCustomHeader, $ SoapPay/oad) Where: ' URI is the Internet address  Now, we will look at how we can engage Rampart to the Web service and apply the security policy. This is done completly using the service descriptor. We don't have to modify the source of the Web service to secure it. First, we engage the Rampart module to the Web service adding <module ref="rampart"/> element to the service descriptor.

Advanced Reporting Guide for MicroStrategy 9.5, An additional example of using REST functions that can support both basic •​ContentType is theInternet media type to use for the web form accessedby the request for provides web services authentication,as defined in the WS Security standard. Thisfunction uses Axis2/C toinvoke web services anduses Rampart/​C to  Hi again Scott, Do you hav any idea when you can think about this. I would need this for = a project and would be happy to do it - but then I would like to do it=20 in a way you are happy with it too :-) Ingo F Ingo Fischer wrote: > Hi Scott >=20 > Hi ! >=20 >> This concept is good overall.

Advanced Reporting Guide for MicroStrategy Analytics Enterprise, that example,the parameterURI provides theURLto access the web service as well is the Internet media type to use for the web form accessed by the request for data. provides web services authentication, as defined in the WS Security standard. This function uses Axis2/C to invoke webservicesanduses Rampart/​C to  A SOAP HTTP request specifies at least two HTTP headers: Content-Type and Content-Length. SMTP is asynchronous and is used in last resort or particular cases. Java implementations of SOAP usually provide a specific binding for the JMS (Java Messaging System) protocol.