RESTlet Web服务-从ASP.NET调用 [英] RESTlet Web Service - Call from ASP.NET

查看:63
本文介绍了RESTlet Web服务-从ASP.NET调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道等效的ASP.NET C#代码来调用Java RESTlet Web服务吗?这是Java客户端版本:

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;
}   


我可以使用HTTPWebRequest进行请求/响应,但是质询/响应让我很烦. .NET中是否有一个相等的调用?


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

推荐答案

如果它是Web服务,那么您可以对其进行引用并调用它的方法,您不需要做所有这一切.这段代码使用的是为该过程编写的类,因此它们必须存在于.NET中才能使用.
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.


这篇关于RESTlet Web服务-从ASP.NET调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆