I'm (again and still) trying to consume some WCF services in Monotouch. First approach: add a web reference in Monodevelop failed. It cannot create the reference file. Then I tried SVCUTIL.EXE and get an error that the generic ChannelFactory is not available in Monotouch - I suppose because there is no reflection available.
Next I tried SLSVCUTIL.EXE from the Silverlight 3 SDK. This generates namespaces for the various services that differ from those created through SVCUTIL.EXE. As I have already lots of wrapper code I have to change a lot.
These questions arise:
WCF is a huge beast and it's very difficult to give general answers on it, too much depends on details. The general rule is that MonoTouch supports the same subset of WCF that was shipped with Silverlight (even if a few additions were made over time).
I suppose because there is no reflection available.
Reflection is available and works with MonoTouch. Reflection.Emit does not since Apple does not allow JIT'ing code on iOS devices. This can limit some API that requires code generation at runtime (but is not an issue if the code generation can be done at compile time).
... This means fixing the code generated by SVCUTIL.EXE. ...
Fighting/editing generated code is usually a bad idea (e.g. future maintenance). I suggest you try to use slsvcutil.exe before investing too much time in customizing the generated code.
... What does code look like that has to be written in that method?
The full source code for Mono's System.ServiceModel and System.ServiceModel.Web are available if you wish to provide your own channel (or customize the generated code).
Totally unclear to me: what is the difference between the two service utilities?
The SL prefix, in slsvcutil.exe, is for Silverlight. Microsoft made this tool to generate code that will only use the WCF subset available in Silverlight. Since this is the same subset supported by MonoTouch this is the best tool to use.
If I get the namespace issue sorted out, will the stubs created through the Silverlight utility make my project work, or will that also suffer from the generic channel issue?
It should work. That's how people are using (the available subset of) WCF with MonoTouch today. If there are issues with this (subset/tool) you can fill a bug report about it (with a test case) and we'll have a look at it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With