Instead of placing info into the MessageContext at the stub level, what you 
could do is write a Module and a Handler that would be placed at the end of 
the phaseOrder on the client side. Then you could add headers there. That way 
you should be ok with whatever Axis2 puts into the header - now and in the 
future. 

BTW, I believe WSS4J already handles that case (I've only done WS-Securtity 
with Axis 1.x) . 

Another point is that you can turn off ws-addressing if you don't need it - 
but then you would have to be careful on what else may be placed into the 
header. 

HTH,
Robert
http://www.braziloutsource.com/ 

Em Sexta 17 Março 2006 07:12, o Gaël Pouzerate escreveu:
> Hi,
>
> I'm using Axis 0.94. I want to be able to modify the soap envelope right
> before it's sent by OperationClient.execute();
> How can I get access to the envelope from the OperationClient object? I
> thought the getMessageContext() would enable this but what parameter should
> I use?
>
> My exact need is to sign the envelope (add some signature in the header)
> right before it's sent: The signature is based on the content of the
> envelope, so that once the envelope is signed, it mustnt' be changed
> anymore.
>
> I've been trying to do it the following way, but it seems that axis adds
> extra stuff (wsa: tags) in the header before sending the envelope, so that
> my signature won't be valid anymore. So I'd like to be able to put my
> signature when the envelope is complete (with wsa tags) right before it's
> sent.
>
> Here is an extract of the code:
>
> public class MySearchEndpointStub extends Stub {
>     public MyResultsDocument search(
>
> OperationClient _operationClient =
> _serviceClient.createClient(_operations[0].getName());
>
> // The envelope created here only contains a body, but an empty header
> SOAPEnvelope env = toEnvelope(getFactory(_options.getSoapVersionURI()),
> requestDoc);
>
> // Here we add a signature in the envelope's header based on it's current
> content
> env = sign(env);
> MessageContext _messageContext = new MessageContext();
> _messageContext.setEnvelope(env);
> _operationClient.addMessageContext(_messageContext);
>
> // The request is sent: I can see in the soap request (by tracing traffic)
> that some extra stuff have been added
> // in the header: a couple of wsa: tags. So my signature is not valid
> anymore
> _operationClient.execute(true);
> }
>
> Any idea on how I could achieve this?
>
> Thanx!
> Gaël

-- 

Reply via email to