Can't create Xamarin Portable Class Library due to IExtendableObject - wcf

I have some troubles with using Portable Class Library. I develop both iOS and Android app and I want to create shared business layer using PCL. However, I use WCF class. Particularly the problem is when I use IExtendableObject, which isn’t exist in PCL. Is it possible to circumvent this problem?

Sorry, but what is exactly IExtendableObject ? Do you mean IExtensibleDataObject ?
Exposing a WCF service does not requires Xamarin. Use your favorite IDE to designa and develop it. You just have to use basicHttpBinding, because Xamarin can only consume a WCF web service using this kind of binding. Do not create a WCF service with a PCL !
PCL allows you to share code between all your mobile applications. In your case, this is at least the proxy code. To create a Xamarin compatible proxy you will use the Silverlight Service Model Proxy Generation Tool from Silverlight SDK 5 (SLsvcUtil.exe). Unfortunatelly, this type ExtensionDataObject isn't available in Silverlight.
I'm a bit surprised to see this requirement in Xamarin as it's used for Forward-Compatible Data Contracts.

Thank you for advise! It works, but we won't do it in our project. Insteed of it, we now use sharing code method: http://docs.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/

Related

WCF with MVC application and mobile app

I'm just wondering how to approach to my project.
In my application I have:
MVC4 project
DB_Project with Interfaces and Models
Repository_Project with interfaces implemantation - I'm using Ninject
Next step is mobile app(XAMARIN), and here is the question:
What kind of WCF project should I choose and why...WCF Service Application or WCF Service Library?
Should I add this project like any other or create separate one?
After choosing WCF project, how to use reference to Repository_Project - is this the right way?
I will give you some thoughts to consider.
1- Your Xamarin app must communicate with an asp.net web api / mvc exposed to the internet. I dont recommend exposing a WCF service to the internet for many reasons.
2- In the Data layer, repositories are abstractions to access your EF dbContext and not to call WCF services.
3- You only add complexity when justified. If you are willing to create WCF project for the xamarin app to communicate with, then i hardly discourage you. WCF project may be created in your case if you have some security policy that enforces 3-tiers architecture where the web api needs a middle tier to access the database. Otherwise, you dont need it.
2-tiers:
Xamarin -> web api -> SQL Server
3-tiers:
Xamarin -> web api -> wcf -> SQL Server

How to implement WCF test client for non windows platform.

I have been evaluating and working on a prototype where I have exposed couple of API using WCF web service. My service is working as expected with managed client in windows platform. My service client can be on any platform. I dont know how to approach for other platform (UNIX). Couple of options I have considered so far -
GSOAP
MONO dotnet
I could not use any one of these due to some constraints. Now the only option I left out to implement my own client which can send soap request and get soap response. My preferred technology is C/C++. I am using wsHttpBinding in my server and will be working on http protocol only.
I am not sure about the following points-
Do I need to implement my own WSDL parser?
Do I need my own serializer?
How could I make my client more flexible so that any changes in my WSDL make minimal code changes on client side?
I am looking for help from the experts who could guide me with a proper approach with a basic client sample.
My experience is in WCF interoperability with Java clients. You can use Java SOAP libraries like metro http://metro.java.net/ or axis http://axis.apache.org/axis2/java/core/index.html . There is even a C library for axis. http://axis.apache.org/axis2/c/core/
I am sure other languages like Ruby/Python etc has similar libraries as well.
The other option is to use a REST based interface and then you can use any language/platform that has HTTP support or even a tool like curl and libcurl http://curl.haxx.se/.

Generic Invoke of WCF services

I'm trying to create some tool for testing WCF services. I'm aware of such products, but the goal is creating of mine one.
Main trouble is in calling wcf methods without having contracts. I've found solutions using scvutil.exe, but I need to make it on the on demand, as soon as I receive service address.
Any advices or links are appreciated.
Thanks.
Visual Studio provides a tool (the WcfTestClient) that will create a proxy for any WSDL based service (it doesn't have to be a WCF service). There are a few limitations with enumerations as data types and a few other quirks but it's a very useful tool. Here is the documentation for the tool.

Integrating WF4.0 with Silverlight 4.0

I am new to both Silverlight and WF (both 4.0 version), i was wondering if we can integrate WF4.0 with Silverlight 4.0 in such a way that, when we click on some button in sliverlight UI the workflow should be executed and the output from the final activity of the workflow is displayed in the Silverlight screen. If it can be done then please provide me with some link or any tutorial where i can learn about this and start implementing.
Thanks in advance.
In WF 4.0 you can have workflows started (or progressed) by WCF endpoints. Therefore, if you can call the WCF endpoint from your Silverlight application you should be able to do this quite easily. Lots of information on Microsoft's WF Developer Centre.
Assuming you are using Visual Studio 2010, you can get up and running with a very simple Silverlight -> WF example very quickly...
Create a new project (and new solution) from the 'WCF Workflow Service Application' template. The project will be named DeclarativeServiceLibraryX. This should give you a very simple WorkflowService definition using SequentialService that simply receives the request from a client (with a single integer argument) and sends a response (with the same value). This project is created as a web project so includes a Web.config.
Create a new Silverlight 4 application. You will be asked if you want to host the Silverlight app in the existing web project (created in step #1). Probably a good idea to say yes.
In the Silverlight application, select 'Add Service Reference...', then 'Discover/ Services in Solution'. Service1.xamlx will appear as an option, select it and click Ok.
VS will then generate a WCF service reference client. You could then add a TextBox & Button to capture some data, create the client and send the service call across the wire to the WCF Workflow Service. This Workflow Service could then be modified as necessary (or use these steps to add a WCF Workflow Service to your own web project).
One area that might be challenging is modifying the WCF service bindings to be compatible with Silverlight; perhaps create a Silverlight-compatible WCF service in your server-side project first, then create a WF WCF endpoint and look at the generated code & config to see how to put things together.
The MSDN Endpoint blog is also a useful resource for learning more about WF and WCF (especially with the new style lightweight REST-style 'WCF Web HTTP' bindings, which might be more suitable for consumption by a Silverlight client.
I am assuming that you don't want to host the workflow inside the Silverlight app itself, as WF is a full .Net framework component rather than being Silverlight compatible. I'm sure you could write your own lightweight workflow framework that runs inside Silverlight, but given workflow is generally a multi-user, server-side concern this probably wouldn't be very useful concern.
I found an example with WPF here for these samples. Hope they will help you a bit or at least give a general look at this topic.
Workflow Foundation is not included in the Silverlight 4.0 runtime and thus cannot be used within a Silverlight app. So Silx answer do not relate at all to Silverlight. And James Websters answer is the only solution to make use of WF from Silverlight.
You cant use WF with silverlight.... the only way is , You can call WCF service to access WF as explained by James Webster.

Tutorial on Consuming a WCF service in ASP.Net web site?

I'm attempting to create my first WCF service.
I've created the service and now I'm trying to call it from a asp.net (vb) web site and I've tried adding a web reference to it and using the scvutil.exe to consume the service.
So far neither have worked. It's not letting me declare the service in my code. If someone could point me to a good tutorial on how to consume a WCF service in an ASP.Net web site that would be great.
I've found numerous on how to use them with AJAX or silverlight or windows apps but nothing on using it in just a plain old website.
Please see Beginner's Guide to Windows Communication Foundation. It's part of the WCF Developer Center on MSDN, which is full of good resources.
The link above is broken. Some other links I've found while searching for it:
Developing Service-Oriented Applications
Windows Communication Foundation
Conceptual Overview
Getting Started Tutorial
How to: Create a Windows Communication Foundation Client
Basic WCF Programming
Just add service reference, use the service reference as using "reference1.xxxx" and then use the client code.
That's all after the initialization. It works for me. Let me know if you require any help.