WCF - Cross platform question

2019-08-09 23:17发布

I have a simple WCF service, self hosting and a .net client. I am generating a proxy using svcutil. When I add the proxy to the client it asks me to add System.ServiceModel.dll. Well, I can add it since it is a test scenario and I am working in .Net platform.

However, suppose I am using a machine that does not support .Net, how that platform would compensate for the System.ServiceModel?

Could you please put some light on it?

EDIT: I got somewhat an idea. If I am creating WCF client I need to add ServiceModel. To Test it I added a ASMX client (Add Web Reference). My service mthod does not take any params. But i get an error in client asking me to enter out int Result, out bool ResultSpecified. Could you please exlain why?

EDIT: Could you please point me to an example - how and what to set true on "DataContractSerializer"

Thanks

Lijo

5条回答
唯我独甜
2楼-- · 2019-08-09 23:27

I think there are two issues here:

  1. If you're self hosting a service, but you want clients not built using .NET to have access to it, then maybe you should consider hosting it within IIS instead. Alternatively, you would need to ensure that your hosting application also includes the metadata bindings (MEX) so that non .NET platforms can access the WSDL.

  2. If you're building a non .NET client, then you'd be using a set of tools or a framework for that platform instead. That being the case, you would use different tools to create a proxy for your service from the WSDL instead.

Hope that helps.

查看更多
对你真心纯属浪费
3楼-- · 2019-08-09 23:29

Odd question. If the client isn't a .NET application, it obviously wouldn't need System.ServiceModel. Clients can be written using any other SOAP library in whatever language the application is using.

查看更多
霸刀☆藐视天下
4楼-- · 2019-08-09 23:33

To eliminate the need for the two out parameters that are generated in a web service proxy, use the [XmlSerializerFormat] attribute on the operation contract. After regenerating the proxy, the method signature should match your definition rather than converting your return type into a data type "Result" and a "ResultSpecified" indicating whether the return variable is present.

查看更多
Viruses.
6楼-- · 2019-08-09 23:43

It would compensate by throwing an exception. You need .NET framework installed to run .NET applications. For cross platform you may take a look at Mono.


Sorry I misunderstood your question. If you expose an endpoint using basicHttpBinding any client that conforms to the WS-I Basic Profile 1.1 will be able to consume the web service without problems. This is the most interoperable binding.

查看更多
登录 后发表回答