Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 2nd, 2008, 01:30 PM
Newbie
 
Join Date: Sep 2008
Posts: 1
Default 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
Reply
  #2  
Old September 22nd, 2008, 10:08 AM
Member
 
Join Date: Dec 2007
Posts: 66
Default

try this
[code=java]
HttpClient client = new HttpClient ();
NTCredentials creds = new NTCredentials (user, password, machine, domain);
client.getState().setProxyCredentials (AuthScope.ANY, creds);
HostConfiguration config = new HostConfiguration ();
config.setProxy (proxyHost, proxyPort);
PostMethod post = new PostMethod (endPoint);
[/code]
it is not working in my case:( may be helpful to you...

Last edited by Nepomuk; September 24th, 2008 at 04:21 PM. Reason: Added [CODE] tags
Reply
  #3  
Old September 24th, 2008, 04:00 AM
numberwhun's Avatar
Forum Leader
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,155
Default

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
Reply
  #4  
Old September 24th, 2008, 04:23 PM
Nepomuk's Avatar
Moderator
 
Join Date: Aug 2007
Location: Germany
Age: 21
Posts: 1,817
Default

Hi Techmighty!
Is there a good reason, why you have different capitalisation?
Quote:
Originally Posted by Techmighty
"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
Reply
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles