Compartilhar via


Consuming WCF Services from Compact Framework 3.5

CF 3.5 introduces support for WCF.

 

Consuming using a WCF client

To create a CF WCF client you will need to generate it using the NetCFSvcUtil tool which is available as a part of the Power Toys download

Use this tool as you would for the desktop to generate a client.

 

Limitation: CF 3.5 only support basicHttpBinding. So in the Web.Config of your Service you will need to modify the binding attribute to binding="basicHttpBinding"

 

Limitation: CF 3.5 supports only Certificate credentials. You have no way of specifying / attaching username and password credentials on your request to the server.

 

Consuming using a Web Reference

 

the exposed WCF service can also be consumed as a standard web reference. Indeed for some time, this might also be the preferred way until WCF client matures.

 

To make your WCF service amenable for this sort of consumption, add the attribute

[ServiceContract(Namespace = "YourName"), XmlSerializerFormat]

 

 Now simply add a web reference to the WCF service and you should be ready to go.

 

for more information check out these posts from Andrew Arnott

 

The WCF subset supported by NetCF

Calling WCF services from NetCF 3.5 using Compact WCF and NetCFSvcUtil.exe

What do you think of the new WCF 'Store and forward' Mail Transport?