2 Replies Latest reply on Jul 1, 2010 5:55 PM by gryffin

    accessing secure wsdl


      Let me try a different tack, I am trying to access an XFire based web service deployed in a vendor product. The API is entirely protected by a BASIC auth which means to access the WSDLs at run time my client needs to supply credentials. Can anyone point me to instructions or an example of how to access a password protected WSDL in a client? Thanks!

        • 1. Re: accessing secure wsdl

          Client code.


              webservice = your_webservice_stub;
              BindingProvider bp = (BindingProvider) your_webservice;
              Map<String, Object> context = bp.getRequestContext();


          //  if you need to change the endpoint

          //  context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
          //  System.out.println("new endpoint: " + endpoint);


          //  if the endpoint is https

          //  System.setProperty("javax.net.ssl.trustStore", [path to your truststore]


          //  System.out.println("add basic auth credentials");
              context.put(BindingProvider.USERNAME_PROPERTY, "[your_username]");
              context.put(BindingProvider.PASSWORD_PROPERTY, "[your_password]");

          • 2. Re: accessing secure wsdl

            Thank you. Unfortunately, I do this already as you can see here:

                        assetApiService = new AssetAPIService( );
                        assetService = assetApiService.getAssetAPIServiceHttpPort();
                        ((BindingProvider)assetService).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "******");
                        ((BindingProvider)assetService).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "******");


            The problem arises because assetApiService = new AssetAPIService( ); fails. It fails because the entire service url is protected. I need to provide the username/password at the time the WSDL is dynamically sought as the ws stub is instantiated.


            So I somehow need to get the credentials into a the context somewhere around here:


                    public AssetAPIService(URL wsdlLocation, QName serviceName) {
                            super(wsdlLocation, serviceName);


            where 'wsdlLocation' is password protected. Thanks!