基于文档或 RPC 的 Web 服务 [英] Document or RPC based web services

查看:42
本文介绍了基于文档或 RPC 的 Web 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的直觉是在实践中首选基于文档的 Web 服务 - 这是其他人的经验吗?他们更容易获得支持吗?(我注意到 SharePoint 在其 WSDL 界面中使用 Any 作为文档类型",我猜这使它基于文档).

My gut feel is that document based web services are preferred in practice - is this other peoples experience? Are they easier to support? (I noted that SharePoint uses Any for the "document type" in its WSDL interface, I guess that makes it Document based).

此外 - 人们现在是否为相同的功能同时提供 WSDL 和 Rest 类型的服务?WSDL 在代码生成方面很流行,但对于 PHP 和 Rails 等前端,他们似乎更喜欢休息.

Also - are people offering both WSDL and Rest type services now for the same functionality? WSDL is popular for code generation, but for front ends like PHP and Rails they seem to prefer rest.

推荐答案

文档与 RPC 只是一个问题,如果您使用需要服务描述的 SOAP Web 服务 (WSDL).RESTful web services不使用WSDL,因为服务无法用WSDL来描述,感觉REST更简单,更容易理解.一些人提议将 WADL 作为描述 REST 服务的一种方式.

Document versus RPC is only a question if you are using SOAP Web Services which require a service description (WSDL). RESTful web services do not not use WSDL because the service can't be described by it, and the feeling is that REST is simpler and easier to understand. Some people have proposed WADL as a way to describe REST services.

Python、Ruby 和 PHP 等语言可以更轻松地使用 REST.WSDL 用于生成可从静态语言轻松调用的 C# 代码(Web 服务代理).当您在 Visual Studio 中添加 Service ReferenceWeb Reference 时会发生这种情况.

Languages like Python, Ruby and PHP make it easier to work with REST. the WSDL is used to generate C# code (a web service proxy) that can be easily called from a static language. This happens when you add a Service Reference or Web Reference in Visual Studio.

您提供 SOAP 服务还是 REST 服务取决于您的用户群.这些服务是通过 Internet 使用还是仅在您的组织内部使用会影响您的选择.SOAP 可能有一些特性(WS-* 标准),它们适用于 B2B 或内部使用,但对于 Internet 服务却很糟糕.

Whether you provide SOAP or REST services depends on your user population. Whether the services are to be used over the internet or just inside your organization affects your choice. SOAP may have some features (WS-* standards) that work well for B2B or internal use, but suck for an internet service.

文档/文字与 RPC 的 SOAP 服务在这篇 IBM DevelopWorks 文章中进行了描述.在互操作性(Java 到 .NET 等)方面,文档/文字通常被认为是最好的.至于是否更容易支持,那要看你的情况了.我个人的观点是,人们倾向于让这些东西变得比实际需要的更复杂,而 REST 更简单的方法更胜一筹.

Document/literal versus RPC for SOAP services are described on this IBM DevelopWorks article. Document/literal is generally considered the best to use in terms of interoperability (Java to .NET etc). As to whether it is easier to support, that depends on your circumstances. My personal view is that people tend to make this stuff more complicated than it needs to be, and REST's simpler approach is superior.

这篇关于基于文档或 RPC 的 Web 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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