0 Replies Latest reply on Sep 9, 2008 11:23 AM by kickmetoandy

    wssecurity client threadsafety question

    kickmetoandy Newbie

      Hello,

      we are using ws security (UsernameTokenProfile) with our JBoss server. The Client is a multithreaded web application. For each web service call we have to add the logged in users credentials to the webservice so we can pass the authentication at the server. The client code looks like :

       TestWebservice_Service service = new TestWebservice_Service();
       TestWebservice port = service.getPort(TestWebservice.class);
      
       ((StubExt) port).setConfigName("Standard WSSecurity Client");
       ((StubExt) port).setSecurityConfig("jboss-wsse-client.xml");
      
       ((BindingProvider) port).getRequestContext().put(StubExt.PROPERTY_AUTH_TYPE, StubExt.PROPERTY_AUTH_TYPE_WSSE);
       ((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "user");
       ((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
       "pwd");
      


      I was wondering i a have to create a new port for each client call or if
      it is possible to share one for all the thread, because the creation of the
      port is quite expensive (and we are using spring to create the client service class). the only difference between the calls is the
      different content in the RequestContext map, due to the differen users.
      As far as i can tell the RequestContext is not ThreadSafe thus i have to
      create a new Port for each call. can anybody confirm this ?

      thanks in advance,
      cheers,
      andy