0

I am calling a web service written in .NET located remotely running under IIS Server.

I created a stub to call the web service using apache axis 1.4. The web service uses NTLM authentication. I try to invoke the web service in this way but the error it's always the same : (401)Unauthorized.

How can I do it?

    final String authUser = "username";
    final String authPassword = "password";

    Stub client = new Stub();
    client.setUsername(authUser);
    client.setPassword(authPassword);

    client._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, url);

    Output output= client.getService();

When the web service is not in .NET and it doesn't have NTLM Authentication the client in Axis 1.4 works.

giuls26
  • 21
  • 6
  • The fact the webservice is written in .NET is not directly relevant - NTLM auth is applied at the IIS level. It could be a static HTML page and you could still use it. The server-side language is entirely transparent to the client. But the NTLM (note not NTML as you put!) is likely to be part of the issue, yes. – ADyson Jan 05 '18 at 09:49
  • Anyway see https://stackoverflow.com/questions/5865539/axis2-client-ntlm-authentication – ADyson Jan 05 '18 at 09:54
  • So what is your suggestion? I I'm able to invoke the service using jax-ws but with axis 1 it does not work. Authenticator.setDefault(new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(authUser, authPassword.toCharArray()); } }); – giuls26 Jan 05 '18 at 10:17
  • The link I posted has multiple suggestions, most of which seem to be about using a different library because the one you're using doesn't support NTLM. Unfortunately I can't tell you more, I'm not a Java dev, I saw this because it was tagged asp.net, although as I mentioned that's not really all that relevant to the question. There is no .NET code to fix here. I have removed the tag. – ADyson Jan 05 '18 at 10:26
  • Ok, good. I would avoid different library but probably Axis 1 doesn't support NTML. – giuls26 Jan 05 '18 at 10:34

0 Answers0