If I want to access the MessageContext to add a header to the
response from a client call, where is the appropriate place in
my code to call MessageContext.getCurrentContext()? if I put
it in the constructor of my service with some debugging code,
it appears that the constructor gets called twice, and only on
the second call is there a non-null MessageContext. here's
some sample code:
the line 'making demo' shows up twice in my Tomcat window. the
impl.Demo constructor is where I try to get a handle to the
MessageContext.
thoughts?
/**
* DemoSoapBindingImpl.java
*
* This file was auto-generated from WSDL
* by the Apache Axis Wsdl2java emitter.
*/
package samples;
public class DemoSoapBindingImpl implements samples.Demo {
private impl.Demo myObject;
public DemoSoapBindingImpl()
{
try
{
myObject = new impl.Demo();
System.err.println("making demo");
}
catch(java.lang.Exception e)
{
System.err.println("failed making demo");
e.printStackTrace();
}
}
public java.lang.String doSomething(java.lang.String in1,
java.lang.String in2, int in3) throws java.rmi.RemoteException {
return myObject.doSomething(in1, in2, in3);
}
}