3 Replies Latest reply on Jul 19, 2007 10:17 AM by Andy Cooper

    WS-Security client?

    Andy Cooper Newbie

      I'm trying to get a standalone JAX-WS client running with WS-Security. At present, it can't find the keystore. The documentation is somewhat incomplete in this regard:

      We did not specify a key store or trust store, because client apps instead use the wsse System properties instead. If this was a web or ejb client (meaning a webservice client in a war or ejb jar file), then we would have specified them in the client descriptor.


      Umm, ok, good. What are the wsse Ssytem properties? How about an example?

        • 1. Re: WS-Security client?
          Pavel Kadlec Novice

          Hello, my WS-Security client looks like this. It works.

          public class TestClient {

          /**
          * @param args
          */
          public static void main(String[] args) throws Exception {

          BasicConfigurator.configure();

          System.setProperty("org.jboss.ws.wsse.keyStore", "resources/wsse.keystore");
          System.setProperty("org.jboss.ws.wsse.trustStore", "resources/wsse.keystore");
          System.setProperty("org.jboss.ws.wsse.keyStorePassword", "jbossws");
          System.setProperty("org.jboss.ws.wsse.trustStorePassword", "jbossws");
          System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");
          System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");


          URL wsdlFileURL = new URL("http://localhost:8080/simpleencrypt?wsdl");
          QName qname = new QName("http://org.jboss.ws/samples/wssecurity", "HelloService");

          URL securityURL = new File("resources/jboss-wsse-client.xml").toURI().toURL();

          Service service = Service.create(wsdlFileURL, qname);
          ((ServiceExt)service).setSecurityConfig(securityURL.toExternalForm());

          Hello port = service.getPort(Hello.class);
          ((StubExt)port).setConfigName("Standard WSSecurity Client");

          String ret = port.echoUserType("hello world!");
          System.out.println(ret);
          }
          }

          • 2. Re: WS-Security client?
            Pavel Kadlec Novice

            I use JBossWS 1.2.1.GA With JBossWS 2.0.0.GA. It works as well. But there is one small change in api. Except the line
            ((ServiceExt)service).setSecurityConfig(securityURL.toExternalForm());
            in JBossWS 1.2.1
            there is the line
            ((StubExt)port).setSecurityConfig(securityURL.toExternalForm());
            inJBossWS 2.0.0.

            • 3. Re: WS-Security client?
              Andy Cooper Newbie

              Thanks! That, and the fact that I can't type in paths correctly, solved my problem :)