Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting WEb services credentials

 
Ravi Narala
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google-ing a bit gave me some good links. You may check that as well.
 
Peer Reynders
Bartender
Posts: 2938
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2938
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic