消息契约是否提供跨不同语言的互操作性?
我正在阅读有关 WCF 服务的信息。我是 WCF 服务的新手。我读到 WCF 提供了互操作性。我想知道它在什么情况下提供互操作性。它是否在使用来自任何其他语言(例如 php)的 .net wcf Web 服务或出于任何不同目的的上下文中提供互操作性。我读过下面的文章。
http://blogs.msdn .com/b/drnick/archive/2006/11/27/mixing-message-contract-attributes.aspx
这样如果我们提供OperationContract wcf web 服务中的所有方法都通过传递或返回某些方法的 MessageContract 和某些方法的 DataContract 那么在 php 或任何其他语言中会发生什么? *以 DataContract 作为参数或返回类型的方法是否可以在 php 或任何其他语言中使用?或者以 MessageContract 作为参数或返回类型的方法是否可以在 php 或任何其他语言中使用?或者两者都可以使用 php 或任何其他语言 *
I am reading about WCF services. I am new to the WCF services. I read that WCF provides interoperability. I want to know in which context it provides the interoperability. Is it providing the interoperability in the context of consuming the .net wcf web services from any other language (e.g. php) or for any different purpose. I have read the following article.
http://blogs.msdn.com/b/drnick/archive/2006/11/27/mixing-message-contract-attributes.aspx
In this way if we provide the OperationContract for all the methods in wcf web service by passing or returning MessageContract for some method and DataContract for some method then what will happen in php or any other language ? *Whether the method having DataContract as parameter or return type are available in php or any other language ? or Whether the method having MessageContract as parameter or return type are available in php or any other language ? or Both are available in php or any other language *
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它是否在使用任何其他语言(例如 php)的 .net WCF Web 服务或出于任何不同目的使用 .net WCF Web 服务的上下文中提供互操作性。
互操作性意味着能够从非.NET平台,只要客户端使用与你的服务相同的Web服务协议。请注意,您可以为 WCF 服务使用多种类型的绑定,但只有 BasicHttpBinding、WSHttpBinding 和 WSDualHttpBinding 支持互操作性。有关详细信息,请参阅 MSDN 文章 系统提供的互操作性绑定支持的 Web 服务协议< /a>.
以 DataContract 作为参数或返回类型的方法是否可以在 php 或任何其他语言中使用?或者以 MessageContract 作为参数或返回类型的方法是否可以在 php 或任何其他语言中使用?或者两者都可以在 php 或任何其他语言中使用
简短的答案是肯定的。例如,如果您使用 BasicHttpBinding,则所有内容都会变成 XML,并且由该语言可用的库将 XML 转换为该语言本机的内容。例如,PHP SoapClient 将 DataContract 返回类型转换为内置 stdClass 对象(请参阅 回显 php 中 wcf 服务的 xml 结果?)。
Is it providing the interoperability in the context of consuming the .net wcf web services from any other language (e.g. php) or for any different purpose.
Interoperability means being able to call your WCF service from a non-.NET platform, as long as the client uses the same web service protocol as your service. Note that you can use many type of bindings for your WCF service, but only BasicHttpBinding, WSHttpBinding and WSDualHttpBinding support interoperability. For more information, refer to the MSDN article Web Services Protocols Supported by System-Provided Interoperability Bindings.
Whether the method having DataContract as parameter or return type are available in php or any other language ? or Whether the method having MessageContract as parameter or return type are available in php or any other language ? or Both are available in php or any other language
The short answer is yes. If you use BasicHttpBinding for example, it all becomes XML, and it's up to the libraries available to that language to convert the XML to something native to the language. For example, the PHP SoapClient translates a DataContract return type to the built-in stdClass object (see Echo xml result from wcf service in php?).
至少 messagecontract 应该提供一个使用 PHP 的可行解决方案,根据 https://github.com/geersch/WcfServicesWithPhp5< /a>.
我可以在 http:// /www.rizalalmashoor.com/blog/calling-a-wcf-service-from-php/。
比较这两种契约类型在 PHP 中的使用方式,我认为将两者结合在同一个 WCF 服务中不会出现问题。
At least messagecontract should provide a workable solution consuming with PHP, according to https://github.com/geersch/WcfServicesWithPhp5.
And I can find a similar post for DataContracts at http://www.rizalalmashoor.com/blog/calling-a-wcf-service-from-php/.
And comparing the way these two contract types are consumed from PHP, I think it would not give a problem combining the two in the same WCF service.