Hello all,
I'm trying to create an Interceptor that is setup under the following
method:
public void getStudy(int studyId) {
try
{
MyInterceptor myInterceptor = new MyInterceptor();
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setServiceClass(OrderServiceSoap.class);
factory.setAddress("
https://uatwebservice.jcorp.com/OrderService.asmx");
factory.getFeatures().add(new WSAddressingFeature());
factory.getOutInterceptors().add( myInterceptor );
OrderServiceSoap os = (OrderServiceSoap) factory.create();
os.getStudy( studyid );
} catch(Exception e) {
e.printStackTrace();
}
}
Below is the code for my Interceptor:
public class MyInterceptor extends AbstractSoapInterceptor {
public MyInterceptor() {
super(Phase.PRE_LOGICAL);
addAfter(MAPAggregator.class.getName());
}
public void handleMessage(SoapMessage arg0) throws Fault
{
Message message = arg0.getMessage();
if (ContextUtils.isOutbound(message))
{
AddressingPropertiesImpl outMaps =
ContextUtils.retrieveMAPs(message, true, true);
if (outMaps != null)
{
outMaps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
}
}
}
}
The problem I've encountered is that ContextUtils.retrieveMAPs(message,
true, true) is returning null.
Aside from adding the the WSaddressFeature to to my ClientProxyFactoryBean,
what else do I need to ensure that the address properties are populated when
the interceptor runs?
Cheers,
Jason.