Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a work-around or replacement for System.Runtime.Serialization.DataContractAttribute in Compact Framework (windows mobile)

We are adding functionality to a Windows Mobile Client to send data to a .NET service. Unfortunately the .cs class that svcutil.exe creates generates unusable code for Compact Framework. (that name does not exist in compact framework)

Is there a replacement or 3rd party class or workaround or any other way to get a mobile app to connect to a service?

We can change the API/service to be Compact-Framework friendly. We are new to the CF game (and .NET in general) We are not sure of the appropriate way to allow CF clients - the "out of the box" method was fine for desktop apps, but alas, not for mobile...

EDIT

I tried using netcfSvcUtil.exe instead but get an error (which I don't get with svcutil.exe). I suppose this means that the service created is just not compatible with compact framework?

I am woefully ignorant of this - but I would assume that the specs for passing data have no correlation between platforms and that the transport can be worked out between the tow. I suppose this is naive...

Any suggestions on how to fix this? Do I need to change the service side to be mobile/compact framework friendly?

EDIT

the error messages I get are:

Error: An Error occurred in the tool.

Error: Error in the application

like image 785
Tim Avatar asked Feb 02 '26 20:02

Tim


2 Answers

As I mentioned in my comment, first thing is to make sure the service us setup with basic HTTP binding to make it CF-friendly.

like image 56
tcarvin Avatar answered Feb 04 '26 11:02

tcarvin


Check the soap version in wsdl, not sure, but I can recall that there was a problem with using SOAP 1.2 in CF. If that is the case, just force WCF to use 1.1 in the config file.

Anyway, post the error message. The problem you describe sounds strange, because usually when there is a problem with wsdl file, SVC do not try to generate any code. Are you sure you are using svc in a way that produces CF code? Have you tried using Add Service Reference in Visual Studio? That worked great for me most of the times.

Edit: I have read your question once more. - You can't use 'normal' svcutil.exe to generate CF code, use netcfsvcutil.exe version - Instead of command line I really recommend to use Visual Studio Add Service Reference, then wizard takes care of everything. - Yes, web services are technology independent and supported by CF, just be sure to use bindings supported by CF (ex. basicHttpBinding) and soap version supported by CF.

WCF <-> Compact Framework scenario could be confusing at the beginning but it does work well.

like image 41
mikus Avatar answered Feb 04 '26 11:02

mikus