我能为一个REST WCF服务自动生成服务引用? [英] Can I generate a service reference automatically for a REST WCF service?
问题描述
中的唯一理由,我可以看到SOAP WCF通过REST(JSON)WCF的事实是,一旦我的业务创建,我可以添加在Visual Studio AA参考,我准备好强类型类的负荷,我和一个客户端类,我可以打电话给我所有的WebMethod通过。它甚至据我记得设置了web.config中。
The ONLY argument I can see for SOAP WCF over REST (json) wcf is the fact that once my service is created I can add a a reference in visual studio and I get a load of strongly typed classes ready for me and a client class that I can call all my webmethod through. It even sets up the web.config as far as I remember.
然而,当我露出一个REST(JSON)服务,我仍然获得WSDL。所以,我想知道是否还可以自动建立我引用的方式?
However when I expose a REST (json) service I still get a WSDL. So Im wondering is there still a way to build my references automatically?
推荐答案
不使用WCF的工具。不同于SOAP(其描述服务的一个既定的协议 - WSDL),REST没有。 WADL是一个这样的协议,但它不是太广泛和WCF不支持它。你仍然可以得到一个WSDL,因为WCF将描述从服务一切可能。但是,WSDL将不会有一个< WSDL:端口>
元素,这将描述REST端点,这就是为什么你得到的WSDL,但不能产生参考吧。
Not using WCF tools. Unlike with SOAP (which has an established protocol for describing services - WSDL), REST doesn't. WADL is one such protocol, but it isn't too widespread and WCF does not support it. You still get a WSDL, because WCF will describe everything it can from the service. However, the WSDL won't have a <wsdl:port>
element, which would describe the REST endpoint, which is why you get the WSDL, but cannot generate a reference to it.
在的 http://blogs.msdn.com/b/carlosfigueira/archive/ 2012/3月26日/混合 - 附加服务引用和WCF的Web-HTTP-AKA-REST的端点不 - 不work.aspx 在这个问题上有很多更多的信息。
The post at http://blogs.msdn.com/b/carlosfigueira/archive/2012/03/26/mixing-add-service-reference-and-wcf-web-http-a-k-a-rest-endpoint-does-not-work.aspx has a lot more info on this issue.
这篇关于我能为一个REST WCF服务自动生成服务引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!