Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does anyone know the equivlent ASP.NET C# code to call a Java RESTlet web service? Here's the Java Client version:

public static function getRestServiceCall(URL : String, userid : String, password : String) : Response
{
	// Prepare the request
	Request request = new Request(Method.GET, URL)   
  
	// Add the client authentication to the call   
	ChallengeScheme scheme = ChallengeScheme.HTTP_BASIC;   
	ChallengeResponse authentication = new ChallengeResponse(scheme,   
        	ID, Pwd);   
	request.setChallengeResponse(authentication);   
  
	// Ask to the HTTP client connector to handle the call   
	Client client = new Client(Protocol.HTTP);   
	Response response = client.handle(request);   
	return   response;
}   

I can request/respond using HTTPWebRequest but the Challenge/Response is throwing me. Is there an equal call in .NET?
Posted

1 solution

If it's a webservice, then you can just make a reference to it and call it's methods, you shouldn't need to do all this. This code is using classes written for the process, so they would need to exist in .NET for you to use them.
 
Share this answer
 
Comments
Don Burton 25-Aug-10 23:04pm    
It's using REST. No WSDL so there are no methods to reference. I call the URL via HTTP and get my results back in XML. However, once I go to production with this particular web service I'll need to pass authentication. I'm not quite sure how the referenced java code translates to .NET.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900