I have a JBoss AS in which a web service is deployed. Calls to this web service produce calls to another web service in another JBoss AS. I'm interested in passing some paramenters in the header of the SOAP messages, so when a SOAP message arrive to the first JBoss AS I read the header parameters, execute some operations on them, and put them to the header of the message directed to the second JBoss AS. I'm using two SOAPHandler, and to pass the parameters to the web service in the first AS I use:
public boolean handleMessage(SOAPMessageContext context) {
...
//get the parameter from the header
...
context.put("parameter", parameter);
context.setScope("parameter", MessageContext.Scope.APPLICATION);
}
So that in the Web Service I can do:
parameter = wsContext.getMessageContext().get("parameter").toString();
...
((BindingProvider) service).getRequestContext().put("parameter", parameter);
And in the second SOAPHandler, the one that manage the messages directed to the second AS:
public boolean handleMessage(SOAPMessageContext context) {
...
parameter = (String) context.get("parameter");
...
//put the parameter in the header
}
That works, but if a new message arrives to the first AS without parameters, the previous ones remains in the context and I get the old parameters going to the second AS.
Maybe this is related to the: MessageContext.Scope.APPLICATION
?