java - JAX-WS client for IIS Integrated Windows authentication (NTLM) -
Recently, I am working on a project for which to create a web service client in Java, Need to run on WS engines for a .NET web service secured by integrated Windows authentication (also called NTLM protocol)
This seems to be a famous issue I searched on the Internet, but so far There is no good solution.
Has anyone done this before?
Any suggestion would be appreciated.
We are using JX-WS, built in Java 6, and the client has Windows XP And the server running on the Windows 2003 server is on the IIS 7 Windows 2003 server.
I found out that the integrated authentication works out of the box. No configuration provided. I turned on trace logging on the HTTP layer, and found that NTLM authentication was being used.
So basically, the answer is: it just works.
To test:
> package url.auth; Import java.io.IOException; Import java.io.InputStream; Import java.net.URL; Import java.net.URLConnection; Import java.util.list; Import java.util.Map; Import org.apache.commons.io.IOUtils; Public class DownloadUrl {public static void main (string [] args) {try url = url = new URL ("http: // myserver / url / that / require / authentication"); URL connection = url.openConnection (); InputStream = conn.getInputStream (); Maps & lt; String, list & lt; String & gt; & Gt; Header = conn.getHeaderFields (); (String header: header key ()) {System.out.println (header + ":" + headers.get (header)); } System.out.println (""); Println (IOUtils.toString (is)); } Hold (IOException e) {e.printStackTrace (); }}}
Comments
Post a Comment