471,870 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,870 software developers and data experts.

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,
Sep 2 '08 #1
3 12689
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);
it is not working in my case:( may be helpful to you...
Sep 22 '08 #2
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.


Sep 24 '08 #3
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.

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
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.