1 Reply Latest reply on Jul 15, 2009 11:39 AM by Alessio Soldano

    JBoss WS Pojos endpoint authentication

    Andrea Gazzarini Newbie

      Hi, I was trying to configure authentication for my pojo endpoint as described on http://www.jboss.org/community/wiki/JBossWS-SecureTransport.
      Well, probelm is that my security constraints (web.xml) is protecting all resources (/*) including WSDL, so when I try to invoke the Service.getPort(...) method that invocation fails because credentials are provided later on BindingProvider as shown below:

      URL wsdlURL = new File("resources/jaxws/samples/context/WEB-INF/wsdl/TestEndpoint.wsdl").toURL();
      QName qname = new QName("http://org.jboss.ws/jaxws/context", "TestEndpointService");
      Service service = Service.create(wsdlURL, qname);
      port = (TestEndpoint)service.getPort(TestEndpoint.class);
      
      BindingProvider bp = (BindingProvider)port;
      bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "kermit");
      bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
      


      Note that authentication is correctly configured : If i try to access to WSDL using a browser I get the authentication POPUP (I configured BASIC authentication); after inserting credentials the WSDL is correctly displayed.

      Could you help me?

      Regards,
      Andrea