title: Creating JAX-WS Client to utilize .NET web service (authentication required)
body: <p>As I said in headline I am trying to hookup JAVA application to remote web service.  I am pretty new to JAVA and Web Services. I am using Eclipse IDE.</p>
  
  <p>First thing I've done was to run <strong>wsimport</strong> in command window. Provided WSDL url, but got error: <strong>FAILED, Could not find WSDL</strong>. I checked multiple times to make sure that url is correct.   </p>
  
  <p>To go around, I saved WSDL locally and thean wsimport didn't have any issues. Moved all generated code to my project and everything seems fine.</p>
  
  <p>Here is my test code</p>
  
  <pre><code>// HAVE TO USE PROXY
  final String authUser = "xxxxxx";
  final String authPassword = "xxxxxx";
  String proxyServer = "proxy1.xxxxx.com";
  String proxyPort = "99999";
  
  System.setProperty("http.proxyHost", proxyServer);
  System.setProperty("http.proxyPort", proxyPort);
  System.setProperty("http.proxyUser", authUser);
  System.setProperty("http.proxyPassword", authPassword);
  
  Authenticator.setDefault(
     new Authenticator() {
        public PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(authUser, authPassword.toCharArray());
        }
     }
  );
  
  WebServiceXX client = new WebServiceXX();
  WebServiceXXSoap port = client.getPort(WebServiceXXSoap.class);
  
  BindingProvider bp = (BindingProvider)port;
  Map&lt;String, Object&gt; req_ctx = bp.getRequestContext();
  
  req_ctx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://domain.com/WebService/WebServiceXX.asmx");
  req_ctx.put(BindingProvider.USERNAME_PROPERTY, "user");
  req_ctx.put(BindingProvider.PASSWORD_PROPERTY, "password");
  
  //HERE, TRYING TO CALL SERVICE. GETTING TIMEOUT ERROR IN 2nd LINE
  WebServiceXXSoap service = client.getWebServiceXXSoap();
  OperationStatusCodesResp StatusCodes = service.GetOperationStatusCodes();
  </code></pre>
  
  <p>In short, I had to use Proxy server. I tested that part and it seems that is fine.
  Since I used local WSDL, I assume that I have to manually set ENDPOINT URL, and since authentication is required, I had to set username and password as you can see it in the code.</p>
  
  <p>The error I am getting is <strong>Time Out Error</strong>.  I am thinking that maybe I didn't set this ENDPOINT properly and that request cannot be made since there is no proper web service url provided.</p>
  
  <p>I tried to edit wsdlLocation in one of the generated java files, to replace local path with real WSDL url, but I am getting error that WSDL can't be found. JAX-WS simply either hate this WSDL or something else is problem. As a note, I didn't have any issues utilizing this service in .NET (C#) application (Web service itself is done in .NET, WSE 2.0)</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks </p>