Consuming WCF Service in MVVM architecture in Model class in Windows Phone - wcf

my requirement is to consume the data from WCF service,in a model class and send to view through View-model but it 's not working taking Null Values,Problem is
while calling the method from wcf service methodnamecompleted event is not firing.
and not taking the values.
Same code is working in Code behind with normal approach but with MVVM in Model class,showing mentioned issue.
If you have suggestions please help me out.
Thank you.

i hope this is help full link
https://msdn.microsoft.com/enus/library/hh205277(v=vs.110).aspx

Related

Call WF Workflow from Browser

OK, I've searched the Internet for the answer to this and haven't found anything... maybe I'm missing the obvious here or just asking the wrong question, but...
How do you call a WF WCF Workflow just by it's URL with parameters? I have a Workflow xmlx, we'll call it DeepThought.xamlx, an operation named TheQuestion and I need to pass the parameter Answer = 42 to it.
I've tried http://localhost:8042/DeepThought.xamlx/TheQuestion?Answer=42 and just about everything else I can think of. I've scoured the Internet and even the wsdl but am either just flat out missing the answer or simply not seeing it.
I assume it's possible, otherwise, what's the point? Clues appreciated.
At least out-of-the-box this is not possible. The standard Receive
activity uses SOAP. I'm sure it's possible to implement a custom Receive but I guess it would be a non-trivial amount of work.
You can also take a look a the following questions. They are REST-related but still may give you some options (a community RESTful endpoint is being mentioned, no idea of its current state though):
RESTful Workflow Service Endpoints in WF4 / WCF
WCF Workflow Service REST interface
I ended up implementing the workflow as a regular activity (non service) inside WCF. This gave me the ability to use their parameters and pass them to the workflow directly. In the end, not too difficult to implement.

Use WCF Data Contract as model for MVC view

I have started working on an application which is structured as follows:
UI - ASP.Net MVC web application
Service Layer - WCF
Entities - a simple class library (exposed by WCF layer)
Data Layer - for database interactions.
Till now, I was defining my models in Models folder of my web application, but now as we have decided to expose them by WCF service (as this application will be consumed by other applications as well), I need some help here.
I tried putting all my model definitions in Entity layer which is exposed by WCF service decorating them with data annotations as well as DataContract attributes. Now, I am able to reference these entities to bind them with my views. But, data annotation validations are not working for me.
Can anybody please help me for a workaround for this ? I have been searching through web for solution but almost all tell me to put a reference of entity layer in web application which will be tight coupling that we do not want. and the other option is to redefine all entities with data annotations in models folder of my web application,which will be duplicate kind of coding.
Is there any better approach for this? Any help appreciated.
Update:
To consume WCF entities, I have put a service reference in my web application. Now, just to check I modified that Reference.cs file by decorating my data Member explicitly with [Required] attribute and it is working fine. but, I understand these changes will go away whenever service code is generated.
Is there any way I can bring that Data annotation attribute here? Kindly help.
As for me It's bad idea, DTO for transfer, Model for MVC.
Look like similar problem
Why You Shouldn’t Expose Your Entities Through Your Services
DTO’s Should Transfer Data, Not Entities

Calling a WCF service from a client without having the contract interface and DTO

I have 3rd party wcf soap service which needs to-be consume so i have discovered a way to generate code in memory and invoke the service with simple input arguments. I would like to do the same with complex arguments can anyone please help me as to how i can achieve this. Or can anyone please point me in the right direction.
Thanks in advance,
Pavan
May be you can use output of datasvcutil at runtime with dynamic code generation/reflection.
http://msdn.microsoft.com/en-us/library/dd756369.aspx

WCF classes not reflecting

I have created a WCF service for my project one of the classes in the service is not reflecting when i add the WCF service to my project, though the class is marked as <DataContract(), Serializable()> _
kindly help
I don't really understand it, but if im right you should add that class as a ServiceKnownType:
http://msdn.microsoft.com/en-us/library/ms554667.aspx

WCF Service public class available to consuming application

I am writing a WCF Service and inside the service application have a couple of classes... I want these to be available to the consuming application but it won't actually pass them back as a parameter, rather it will add them into a object array and then pass them back. Seems the only way I can find to make available to .NET App is to have them as a parameter in a service method.
Am I missing something obvious?
Thanks
Found answer, sorry:
add to IService
[ServiceKnownType(typeof())]