繁体   English   中英

如何创建 WCF 客户端以连接到使用 JRuby 和 sinatra 构建的 web 服务?

[英]How to create a WCF client to connect to a web service built using JRuby and sinatra?

我有一个用 JRuby 编写的 REST web 服务并使用 sinatra。 它有一个端点。

http://localhost:4567/v4/start.htm

我有一个连接到 JRuby web 服务的 Javascript web 客户端。

But now I want to use C# and WCF to connect to this web service instead of using a Javascript web client.

我怎样才能做到这一点?

谢谢

The classic model of using WCF in the client assumes SOAP and the availability of WSDL - neither of which are true for a REST service. 你有几个选择:

  1. 使用 [WebGet]/[WebInvoke] 手工制作等效的 REST 样式服务合同并使用 WebChannelFactory 创建代理
  2. Look at the REST Starter Kit Preview 2 or the new Web API where you will find a class called HttpClient for invoking a REST service

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM