0 Replies Latest reply on Nov 7, 2006 11:04 AM by John Gilbert

    org.jboss.remoting.CannotConnectException: Can not connect h

    John Gilbert Apprentice

      I am trying to call a secured web service from a SLSB. I have injected the port using @Resource but get a connection exception because the credentials are not set. I have come up with a workaround to propagate the credentials (see below). But I would like to know if there is a standards based way to propagate credentials to the jaxrpc stub.

      Do I just need to wait for the full JaxWS implementation in JBossWS 2.0?


      @Stateless
      @RolesAllowed(value = { "User" })
      @SecurityDomain("portal")
      public class AuthorizationCallbackServiceAdapterBean implements AuthorizationCallbackServiceLocal {
      
       @Resource(mappedName = "jbossws-client/service/AuthorizationCallbackService")
       protected AuthorizationCallbackService_PortType port;
      
       public void authorizationResponse(Long paymentId, Boolean status) {
       try {
       Stub stub = (Stub) port;
       stub._setProperty(Stub.USERNAME_PROPERTY, SecurityAssociation.getCallerPrincipal().getName());
       stub._setProperty(Stub.PASSWORD_PROPERTY, SecurityAssociation.getCredential());
      
       port.authorizationResponse(paymentId, status);
      
       } catch (Exception e) {
       throw new RuntimeException(e);
       }
       }
      }
      


      Calling SecurityAssociation and setting the properties on the stub is the prioritary workaround that i would like to avoid.