File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes SOAP Header missing using  (Hash values do not match ) Rampart/Axis2 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 "SOAP Header missing using  (Hash values do not match ) Rampart/Axis2" Watch "SOAP Header missing using  (Hash values do not match ) Rampart/Axis2" New topic

SOAP Header missing using (Hash values do not match ) Rampart/Axis2

Antonio Vilela

Joined: Sep 08, 2010
Posts: 1
Hi all,
I am writing a java client to consume a web service that I have no control of. The web service requires a sign message. I have configured Rampart to sign the message with file policy.xml and code.

Server WS return this error:

org.apache.axis2.AxisFault: SOAP header missing
[java] at org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(
[java] at org.apache.rampart.handler.RampartReceiver.invoke(
[java] at org.apache.axis2.engine.Phase.invoke(
[java] at org.apache.axis2.engine.AxisEngine.invoke(
[java] at org.apache.axis2.engine.AxisEngine.receive(
[java] at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(
[java] at org.apache.axis2.description.OutInAxisOperationClient.send(
[java] at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
[java] at org.apache.axis2.client.OperationClient.execute(
[java] at es.contrataciondelestado.b2b.publicacion.ServicioPublicacionB2BStub.getExpedientState(
[java] at PruebaCliente.main(
[java] Caused by: org.apache.rampart.RampartException: SOAP header missing
[java] at org.apache.rampart.RampartEngine.process(
[java] at org.apache.rampart.handler.RampartReceiver.invoke(
[java] ... 9 more

The server who validate the messages is an IBM Websphere DataPower XS40 and return the error "Hash values do not match. (from client)".

I'm using axis2-1.5.1, rampart-1.5, jdk1.6.0_20

My policy.xml is:

<?xml version="1.0" encoding="UTF-8"?>

<wsp:Policy wsu:Id="SigEncr" xmlns:wsu="" xmlns:wsp="">
<sp:AsymmetricBinding xmlns:sp="">
<sp:X509Token sp:IncludeToken="">
<sp:X509Token sp:IncludeToken="">
<sp:Wss10 xmlns:sp="">
<sp:SignedParts xmlns:sp="">
<sp:EncryptedParts xmlns:sp="">
<ramp:RampartConfig xmlns:ramp="">
<ramp:crypto provider="">
<ramp:property name="">JKS</ramp:property>
<ramp:property name="">client.keystore</ramp:property>
<ramp:property name="">nosecret</ramp:property>


My java class is:

public class PruebaCliente {
* Load policy file from classpath.
private static Policy loadPolicy(String name) throws XMLStreamException {
ClassLoader loader = PruebaCliente.class.getClassLoader();
InputStream resource = loader.getResourceAsStream(name);
StAXOMBuilder builder = new StAXOMBuilder(resource);
return PolicyEngine.getPolicy(builder.getDocumentElement());

public static void main(String[] args) {
PruebaCliente pc = new PruebaCliente();
Logger log = Logger.getLogger( pc.getClass() );
System.setProperty("", "security/almacenPLACE.jks");
System.setProperty("", "changeit");

// create the client stub
String target = "https://ip:port/service";

ServicioPublicacionB2BStub stub;
try {

stub = new ServicioPublicacionB2BStub(target);
System.out.println("Stub initializated");

// configure and engage Rampart
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();

try {
RampartConfig rampartConfig = new RampartConfig();
Properties merlinProp = new Properties();
merlinProp.put("", "PKCS12");
merlinProp.put("", "clienteplace");
merlinProp.put("", "changeit");
CryptoConfig cryptoConfig = new CryptoConfig();

StAXOMBuilder builder = new StAXOMBuilder("security/policy.xml");
Policy policy = PolicyEngine.getPolicy(builder.getDocumentElement());

options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

// web service call
GetExpedientStateDocument gesDocument = GetExpedientStateDocument.Factory.newInstance();
GetExpedientStateDocument.GetExpedientState ges = gesDocument.addNewGetExpedientState();


} catch (XMLStreamException e) {
// TODO Auto-generated catch block
} catch (RemoteException e) {
// TODO Auto-generated catch block
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
} catch (AxisFault e) {
// TODO Auto-generated catch block


Please, any help is appreciated.


I agree. Here's the link:
subject: SOAP Header missing using (Hash values do not match ) Rampart/Axis2
Similar Threads
Need Java Client stubs for given WSDL
Issue with using the Axis2 JAX-WS Client using Rampart
Rampart/Axis2 not generating Security Header.
Exception in thread "main" org.apache.axis2.AxisFault: Error in extracting message properties
SOAP Header missing using Rampart w/ Axis2 Generated Stub