469,338 Members | 8,424 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,338 developers. It's quick & easy.

How to pass networkcredentials in java client code for .Net web service?

Hello All,

I want to invoke the .Net Based webservice from a java client code using axis api.

As we pass the credentials in .Net
"uin.Credentials = new NetworkCredential("administrator", "Tech1234", "WORKGROUP");"

I have to pass them in java code.

I have tried with
" System.setProperty("http.proxyUser","Administrator ");
System.setProperty("http.proxyPassword","Tech1234" );
"
But still I am getting 401 Unauthorized response.

How I can pass these credentials through a java code?

Thanks And Regards,
Amarja
Sep 2 '08 #1
3 12240
try this
Expand|Select|Wrap|Line Numbers
  1. HttpClient client = new HttpClient ();
  2. NTCredentials creds = new NTCredentials (user, password, machine, domain);
  3. client.getState().setProxyCredentials (AuthScope.ANY, creds);
  4. HostConfiguration config = new HostConfiguration ();
  5. config.setProxy (proxyHost, proxyPort);
  6. PostMethod post = new PostMethod (endPoint);
  7.  
it is not working in my case:( may be helpful to you...
Sep 22 '08 #2
numberwhun
3,503 Expert Mod 2GB
I believe this to actually be a Java question and not an Apache question. For that reason, I am moving this to the Java forum.

Regards,

Jeff
Sep 24 '08 #3
Nepomuk
3,112 Expert 2GB
Hi Techmighty!
Is there a good reason, why you have different capitalisation?
"uin.Credentials = new NetworkCredential("administrator", "Tech1234", "WORKGROUP");"
...
" System.setProperty("http.proxyUser","Administrator ");
System.setProperty("http.proxyPassword","Tech1234" );
"
("administrator" vs. "Administrator") That could be your Problem.

Greetings,
Nepomuk
Sep 24 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Paul Hutchinson | last post: by
1 post views Thread by Samudrala | last post: by
2 posts views Thread by maleone41 | last post: by
5 posts views Thread by Nick K. | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.