Try changing:
ContextUtils.retrieveMAPs(message, true, true);
to:
ContextUtils.retrieveMAPs(message, false, true);
If that doesn't work, you may need to dig into the Message contents to see
what is there:
for (String s : message.keySet()) {
System.out.println(s + " " + message.get(s).getClass().getName());
}
or so to see what's there. If the map isn't there, try something like:
System.out.println(message.getInterceptorChain())
to make sure the MAPAggregator interceptor was really there and in the right
place.
Dan
On Wed November 11 2009 1:14:34 pm Jason Clark wrote:
> 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.
>
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog