Hi All,

Problem #1 :

I am implementing a service with both WS and RS annotations. I encounter the following problem:

   @Resource
   private Exchange exchange;

   @GET
   @Path("/")
   @WebMethod
   @WebResult(name="object")
   public Object getObject(long id) {
       System.out.println("exchange: " + exchange);
   }

If I try to access it via SOAP, the exchange object IS null; but if I try to access the method via ReST, the exchange object is NOT null. As a follow-up question, would the exchange object be different for each transaction, i.e. thread-safe?

Problem #2 :
How do I access the context from an interceptor? Given the following:
public class SoapInHandler extends AbstractPhaseInterceptor<SoapMessage>{
   private static Logger logger = Logger.getLogger(SoapInHandler.class);
   public SoapInHandler() {
//        not sure which phase to use.
//        super(Phase.UNMARSHAL);
//        super(Phase.PRE_INVOKE);
//        super(Phase.READ);
       super(Phase.POST_PROTOCOL);
   }

   @Override
   public void handleMessage(SoapMessage message) throws Fault {
       // i need to get the UserPrincipal here...
       // i need to get the UserPrincipal here...
       try {
SoapHeader security = (SoapHeader)message.getHeader(new QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security";));
           //this always returns empty
           logger.info("actor: " + security.getActor());
       } catch(Exception e){
           logger.warn("unable to retrieve actor.." + e.getMessage(), e);
       }
   }
}

I tried retrieving the wsse:Security header, but I am not able to retrieve the username token or any of it's child nodes.

Any suggestions?

Again, thanks in advance.

Gabo

Reply via email to