Creating Default Bindings on Compact Framework

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

For creating of service proxies on Compact Framework (Mobile), which are WCF capable, the tool NetCfSvcUtil should be used.
This tool is a part of .NET Compact Framework Power Toys 3.5. Note that WCF-CF edition is very small subset of WCF and it does not support everything. However on the basic level you will probably feel that almost everything is supported. This is fine.
The biggest difference between these two builds is how they are build internally. And that is relevant at least when you decide to build some customization, which extends the compact framework stack.

In general the NetCfSvcUtil build proxy, which use hard coded binding, but it has constructors which allows you to slightly modify default bindings.

In general CF provides build in support for WS-I standard (basicHttpBinding) . If HTTP is used the binding looks like:

image

In a case of HTTPS the binding looks like shown below:
image

Please note marked differences.

System.ServiceModel.Channels.CustomBinding binding = new System.ServiceModel.Channels.CustomBinding();
            binding.Elements.Add(new System.ServiceModel.Channels.TextMessageEncodingBindingElement(
                System.ServiceModel.Channels.MessageVersion.Soap11, System.Text.Encoding.UTF8));
            System.ServiceModel.Channels.HttpsTransportBindingElement https =
                new System.ServiceModel.Channels.HttpsTransportBindingElement();
            https.RequireClientCertificate = false;
            binding.Elements.Add(https);
            return binding;

            System.ServiceModel.Channels.CustomBinding binding = new System.ServiceModel.Channels.CustomBinding();
            binding.Elements.Add(new System.ServiceModel.Channels.TextMessageEncodingBindingElement(
                System.ServiceModel.Channels.MessageVersion.Soap11, System.Text.Encoding.UTF8));

            binding.Elements.Add(new System.ServiceModel.Channels.HttpTransportBindingElement());
            return binding;


Posted Aug 23 2008, 02:30 PM by Damir Dobric
Filed under:

Comments

Helmik wrote re: Creating Default Bindings on Compact Framework
on 07-28-2011 11:02

Thank you very much for this article!

developers.de is a .Net Community Blog powered by daenet GmbH.