0

I have the following scenario: I have a website in ASP.NET 2.0. which calls another webservice (which is in JAVA) to retrieve the user's information. This webservice is password protected and uses "https" as its transport (If I enter the webservice's address in the address bar of the browser, "Windows Security" windows pops up saying "The server at Unprotected Root [IP address] requires a username and passowrd, I don't know if this is called as password protected webservice.) After I put the user name and password, supplied by the webservice group, I am able to see their some general message which indicates that the authentication is done.

Is the following code good for above scenario:

WebServiceProxy client=new WebServiceProxy();
client.Url=@"serviceEndPoint";

...

NetworkCredential netCred=new NetworkCredential();
netCred.UserName="UserName";//*User name supplied by WebService group.
netCred.Password="Password";//*Password supplied by WebService group.
client.Credentials=netCred;
var retObject=client.GetUserInfo(userId);

Is this what I should do to pass the user name/password ?

To solve this, I created a Soap message in a tool called "soapUI" and called the service, and I am able to get the response with the user info (user object). But from the code, I get the response, but with user object as null.

1
  • If you get a response, then it would seem the authentication worked. You'd have to ask the service owner why you don't get the user info back. Commented Nov 2, 2012 at 1:23

1 Answer 1

1

Whether the service has been created in Java or DotNet. It doesn't matter, everything will be consumed in the same way.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.