3 Replies Latest reply on Mar 7, 2012 10:08 PM by spyhunter99

    Password encode/decode in jboss

    its_me

      Hello All,

       

      We have a requirement in which, our java web application needs to submit a WSDL request to another application. This requires a user name and password. As you can understand that it is not possible for us to harcode the username/ password with in the code. Is it possible to use any built in encoder/decoder in jboss to bring any encoded password in a file on server to the WSDL submit?

       

      Thanks in Advance.

      Regards,

      Nid....................

        • 1. Re: Password encode/decode in jboss
          spyhunter99

          Of course. your best bet is to roll your own encryption/decryption class using the built in jdk ciphers and then store the values in a properties file within your deployment.

           

          A better solution:

          download all of the wsdls and xsds needed for the remote service, edit the files to use only local references (not http references), and then place all of these files within the META-INF folder of the thing creating the web service proxy. Then you can pass a reference to the wsdl using something like this:

           

           

          URL wsdl = Thread.currentThread().getContextClassLoader().getResource("META-INF/mywsdl.wsdl");

          if (wsdl==null)

          wsdl = Thread.currentThread().getContextClassLoader().getResource("/META-INF/mywsdl.wsdl");

          //Note, this extra check is necessary in case your either in linux or you're using OpenJDK instead of Sun's JDK

           

          MyService svc = new MyService(wsdl, qname);

          MyPort port = svc.getMyPort();

          BindingProvider bp = (BindingProvider)port;

          Map<String, Object> context = bp.getRequestContext();

          context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"http://someurl_to_the_service");

           

          port.doSomething();

           

           

          Personally, I think its absolutely stupid that jaxws requires the wsdl at runtime. It should be a build time only thing, as is the case with all microsoft soap stacks.

          • 2. Re: Password encode/decode in jboss
            its_me

            Hello Spyhunter,

             

            We do specify the end point address in the WSDL. But we have an issue where the service used by WSDL, internally requires a particular user name and password. So, we are back to square one where we need to encode/decode them.

             

            It would be helpful if you can explain how to use the jdk ciphers with an example in our case.

             

            Thanks and Regards,

            Nid.................

            • 3. Re: Password encode/decode in jboss
              spyhunter99