[jboss-user] [JBossWS] - Re: Secure Webservice

rbellia do-not-reply at jboss.com
Thu Sep 6 11:42:02 EDT 2007


I have the same probelm with JBoss AS 4.2.1 ...

The endpoint:

  | @Stateless @WebService
  | @RolesAllowed({"clerk"})
  | public class CalculatorBean implements CalculatorRemote, CalculatorLocal {
  |   
  |   @Resource SessionContext sessionCtx;
  |   
  |   public Integer sum(Integer a, Integer b) {
  |     System.out.println("who is it ? " + sessionCtx.getCallerPrincipal());
  |     return a + b;
  |   }
  |   
  | }
  | 


The client:

  |       CalculatorBeanService service = new CalculatorBeanService();
  |       CalculatorBean port = service.getCalculatorBeanPort();
  |       BindingProvider bp = (BindingProvider) port;
  |       bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/CalculatorBeanService/CalculatorBean");
  |       bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "user1");
  |       bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "password1");
  |       
  |       // TODO initialize WS operation arguments here
  |       java.lang.Integer result = port.sum(4002, 450);
  |       System.out.println("Result = "+result);
  | 

The exception:
javax.xml.ws.soap.SOAPFaultException: Authorization failure
  | 

The security domain works fine if I use a remote EJB client.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081727#4081727

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081727



More information about the jboss-user mailing list