且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Web服务VS Web应用程序

更新时间:2022-11-06 19:04:59

在低层次的Web应用程序和Web服务都还挺同样的事情。他们都在operatate HTTP(S)。 SOAP只是一个XML定义良好的版本。 REST是有点儿只是HTTP。如果你愿意,你可以做一个Web应用程序看起来像Web服务,反之亦然。

At a low level web applications and web services are kinda the same thing. They both operatate over http(s). SOAP is just a well defined version of XML. REST is kinda just HTTP. If you wanted to, you could make a web application look like web services and visa versa.

的主要区别是根据你所使用的平台上内部开发的选项。如果,例如,您正在使用的Visual Studio然后添加一个WCF服务应用程序会给你一个项目,该项目是在默认情况下对WCF面向。但是,选择任何其他应用程序类型将不会从添加Web服务阻止你。

The main difference would be internal development options based on the platform you are using. If, for example, you are using Visual Studio then adding a WCF Service Application will give you a project which is by default geared towards WCF. But choosing any other application type won't stop you from adding Web Services.

使用SOAP一般比普通的旧XML这些原因一个更好的选择:

Using SOAP is generally a better option than plain old xml for these reasons:


  • 您的用户将期待它,并有可能知道如何已经阅读。

  • Your users will be expecting it, and are likely to know how to read it already.

您用户的开发环境,将很可能都知道SOAP和能够跨preT它的开箱。 (如果您提供一个WSDL文件那么很多用户将可以使用脚本生成在几秒钟内你的类。)

Your users' development environments will likely know all about SOAP and be able to interpret it out of the box. (If you provide a WSDL file then many users will be able to use a script to generate your classes in seconds.)

您的消息更容易被明确界定。我的工作在那里的另一面已经定义自己的随机XML结构的那一刻一个项目,这是一起工作的噩梦。我从来没有真正知道会发生什么,有其不同的信息类型之间很少具有一致性。至少如果他们同意遵守SOAP话,我可能有一个更容易的时间间preting他们的消息。

Your messages are more likely to be well defined. I am working on a project at the moment where the other side have defined their own random XML structure and it is a nightmare to work with. I never really know what to expect, and there is little consistency between their different message types. At least if they had agreed to conform to SOAP then I might have had a much easier time interpreting their messages.