File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Setting WEb services credentials Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Setting WEb services credentials" Watch "Setting WEb services credentials" New topic
Author

Setting WEb services credentials

Ravi Narala
Greenhorn

Joined: Oct 23, 2007
Posts: 16
Hello,
I am calling a .NET Web service that uses NTLM authentication. How do I pass the credentials to the web service from my JAX-RPC Client.
thanks,
Ravi

SCJP, SCWCD5, SCBCD5, SCDJWS
IBM Certified Websphere 6.1 Core Admin
IBM Certified SOA Solution Designer
SCEA Part 1
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Google-ing a bit gave me some good links. You may check that as well.


Spritle Software Blogs
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Given that there is no official specification for NTLM (this is the closest description) support of NTLM in combination with JAX-RPC would be highly vendor dependent.

If you are bound to using NTLM then using an Axis2 client would the easiest route. Axis2 clients use the Jarkarta Commons HttpClient which can deal with NTLM.

Axis2 HTTP Transport: Basic, Digest and NTLM Authentication.
Ravi Narala
Greenhorn

Joined: Oct 23, 2007
Posts: 16
Thanks for the replies. I did go thru those links. Most of them talk about passing credentials using Axis. In this case we have a JAX-RPC client with generated stubs that run on Websphere. I was not sure on cross platform interoperability.

Besides, I came across a class by name sun.net.www.protocol.http.NTLMAuthenication that takes a URL and PasswordAuthentication as parameters. But its got a restricted visibility that does not allow me to import the class. I have the endpoint URL and i was able to build a PasswordAuth object. If I could build the NTLMAuth object I can set this property on the stub. This is where I am stuck.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
I suspect that is an internal class that is instantiated once the "WWW-Authenticate: NTLM" header is seen. Apparently you need to set up a subclass of java.net.Authenticator to return the required authentication information (see Http Authentication) and then set it as the default by calling java.net.Authenticator.setDefault(myAuthenticator). Of course this will only work if your JAX-RPC implementation actually uses the java.net.HttpURLConnection class.

Then again it may just be a matter of setting the correct properties as there is a http.auth.ntlm.domain property (see Networking Properties).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting WEb services credentials