[jboss-user] [JBossWS] - Re: UsernameToken authentication using JBossWS

Leandro Sales leandroal at gmail.com
Thu Dec 6 19:17:17 EST 2007


<?xml version="1.0" encoding="UTF-8"?>
<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
  <config>
    <username/>
  </config>	
</jboss-ws-security>

And yes, I already did this like. Please, see the following code:

I use the wsconsumer.sh and jboss generated all the java classes
necessary to have the objects, and I have the following code:

(... some imports ...)

@Stateless
@WebService(endpointInterface="bean.WeatherInfoIF")
@WebServiceClient(name = "Vaisala", targetNamespace = "http://www.xxx.com/",
               wsdlLocation = "http://xxx/WebS/xxx.asmx?WSDL")
public class MyInfoBean implements InfoIF {

      public MyInfoBean() {

      }

      public String makeRequest(int arg0) {
              Service service = null;

      try {
          URL wsdlLocation = new URL("http://xxx/WebS/xxx.asmx?WSDL");
          QName serviceName = new QName("http://www.xxx.com/", "TheService");
          service = Service.create(wsdlLocation, serviceName);
      }
      catch(Exception e)
      {
          e.printStackTrace();
      }

      ServiceSOAP serviceSoap = service.getPort(ServiceSOAP.class);

      URL url = null;
              try {
                      url = new
File("/home/leandro/jboss-wsse-client.xml").toURL();

((StubExt)serviceSoap).setSecurityConfig(url.toExternalForm());
              } catch (MalformedURLException e) {
                      e.printStackTrace();
              }

      ((StubExt)serviceSoap).setConfigName("Standard WSSecurity Client");

      UsernameToken usernameToken = new UsernameToken();
      usernameToken.setUsername("user");
      usernameToken.setPassword("pass");

      // I NEED TO PASS THE UsernameToken information to be inserted
into the SOAP-Header of the SOAP envelop, how to do this?

      String stations = serviceSoap.getName();


      return "";
      }

}

By the way, I'm getting HTTP 404 Error when I try to access
http://www.jboss.com/ws-security/config.

I can't call serviceSoap.getName() because I don't know how to pass
the UsernameToken object. Anyone to help me?

Thank you,
Leandro.




2007/12/6, alessio.soldano at jboss.com <do-not-reply at jboss.com>:
> Did you try with the username element in your jboss-wsse-client descriptor? Here is some documentation about the UsernameToken Authentication in JBossWS: http://jbws.dyndns.org/mediawiki/index.php?title=WS-Security_options#Username_Token_Authentication
>
> Moreover, you'll have to set the username/password in your BindindProvider before performing the invocation. You don't have to manually deal with the soap-handler and its tokens, since the jbossws ws-security extension will do it for you.
>
> View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111046#4111046
>
> Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111046
> _______________________________________________
> jboss-user mailing list
> jboss-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-user
>


-- 
Leandro Melo de Sales.
Pervasive and Embedded Computing Laboratory
BRisa and E-Phone Projects Manager
Network Admin @ http://embedded.ufcg.edu.br/indexen.html
+55 83 3310-1404 (extension 208)

O especialista é alguém que conhece sempre mais sobre cada vez menos e
termina por saber tudo sobre nada!




More information about the jboss-user mailing list