WCF service communicating with web app client and android client - c#

I'm new to the community, I hope I'm asking right.
I have a WCF service that should receive connections from both "web app client" and "Android app".
Is it possible to do this?
As I understood the best way to connect to Android is using JSON, but how can I manage the connection to the web app?
Thank you.

Your question is right!
(i)Yes it is possible, since wcf services can be consumed by both web and android app.
(ii)You can either use SOAP/JSON for android and web app, your connections can be maintained in the web.config.

Yes You can use WCF for both web client as well as android, I would suggest you to use Restful WCF as Android does not support Soap by default.

Related

Communicating Azure Web app with WCF Web App

I need to host ASP.NET based app as Azure Web App which should communicate with WCF based Azure Web App. ( WCF app is also an azure Web App not an on-premise app at all).
What are possible ways to achieve easy and flexible communication between both app services?
Do we need to establish a communication channel specifically?
Both Apps under IIS On-Premises are used to communicate without any problem over NET TCP protocol. But I think now we need both services to communicate over HTTP instead of Net TCP?
What problems we may have?
What things do we need to bear in mind?
First of all, we need to be clear that azure webapp only supports ports 80 and 443.
Secondly, in your project, you said that it runs normally in local, because I don't know what you mean by communicate, and I don't know how to achieve it. Normal communication may be socket or websocket, etc. It is not clear what communication you are talking about. If it is socket and you need to use a port other than 443/80, then it is not supported.
But I know clearly that azure web app supports wcf, which means that both of your webapps can be deployed successfully and run normally. If there is a problem, you can update the error details in the post, and we can provide you with further assistance.

Can you add a web service to an existing Windows Service project (.NET)?

I already have a Windows Service project that runs scheduled tasks as part of a larger application. I want to add some Web Services to it (i.e. SOAP), so that some .NET clients can connect and request services (this is all on a LAN, not over the internet). The server application is a Service Project with references to some class library projects.
Is this something that can be done, or does the web service require that I create an ASP.NET project? Sorry for the very basic question, but I'm not sure where to start.
You can create a new WCF service without creating an APS.NET webservice and you can use SOAP to communicate with it.
Maybe this MSDN link can help you more.
The answer is that a Windows Service can "self host" WCF WebServices using the ServiceHost class.
Relevant article: Hosting and Consuming WCF Services.
Specific section: Hosting in Windows Services.

Android app + web service

I'm new in Mobile dev. Going to use C#. I'm going to write small android(maybe iOs in the future) app. And I can't figure out what I need to use as web server. I want mobile client to send requests to server and get result from it. Best idea I have - use WCF web service and json.
Is it a good idea?
What can I use except WCF?
What could I read about web servers for mobile application?
P.S. Link for some tutorial will be great.
There are tonnes of tutorials out there on this topic.
I would use socket connections
For C# you can create a TCP Listener using sockets
using System.Net.Sockets;
https://msdn.microsoft.com/en-GB/library/bb397809(v=vs.90).aspx
and like wise for the android
TCP sockets would be an easy implementation.
http://examples.javacodegeeks.com/android/core/socket-core/android-socket-example/
As for Android and connectivity.
the Android developer platform is always a good start.
developer.android.com/training/building-connectivity.html
Or you could create a Rest interface in c#
codeproject.com/Articles/112470/Developing-a-REST-Web-Service-using-C-A-walkthroug
and make a http call in android. depends on your intended application to what will be better for you
Why REST + JSON is preferred over SOAP for mobile web services
http://www.bamboorocketapps.com/rest-json-vs-soap-xml/

How to make an Asynchronus call to WCF service from a smart device application?

I am developing a smart device application, which is going to communicate with a wcf service over wi-fi. As there is no option to add a service reference into a smart device project I decided to use the NetCFSvcUtil.exe. Everything works great!
But...
In the end I understood that the application must interact with the service in the background.
Having read this article Microsoft .NET Compact Framework Background Processing Techniques. I decided to use the Asynchronous Web Service Call. There http://msdn.microsoft.com/ru-ru/library/aa347733.aspx I found the /async parameter, but it appeared to not work for the NetCFSvcUtil.exe.
What can I do to get the async proxy for my smart device application? Is there a way to generate it or I'm expected to add async methods to the interface with my own hands? Maybe it would be suitable for .Net CF to use SvcUtil.exe to generate the async proxy in my case?
A further more information like which platform you are using to build your Smart phone application would be helpful.
I have done Blackberry development and consumed web services. There are two ways you could build your web services
RestFul Service - Consumption of web services would be pretty easy. Posting data could be a little pain as multipart form data is posted as stream in Wcf - Rest Starter Kit
Soap Service - If you decide to use SOAP, then for blackberry and Android you have to use preverified KSOAP -2 to send and receive soap messages between your app and the web service. If you decide to use KSOAP -2 , go back ASMX services. Somehow WCF services does not communicate with KSOAP -2 (due to change in SOAP version or something) where as a simple ASMX service works pretty smoothly. There are dozens of article which you could use to learn how to use KSOAP
he original idea was to host it in a windows service...
Windows Services could never be web facing. If you want any thing to be web facing, you need a Web Server !
In the end it worked. The "Add web reference" tool created a proxy with Begin/End async methods and the proxy interacted with the wcf service hosted by a simple console application (later a windows service) through the URL property of the proxy.

web application c#

Im trying to make a a cleint/server web application where eventually the client application will be deploy on the internet. People told me to use visual studio WCF duplex but im confuse on how that works. I know for a simple server/client application using sockets, u can just use console for the server and then a windows form for the client.
So how does WCF duplex work, will it be used for both the server and the client side or do i sill use console for the server?? Also how do they establish a connection, in sockets you use ip address and a port.. HELP!
There are many WCF bindings that enable full-duplex communication. WCF servers and clients are able to use sockets among other means of communication. With WCF you can still use the IP Address:Port address system to expose and consume services.
With WCF you still can use Console Apps, Windows Forms or Web Applications to expose or consume those services. It brings no restriction at this point.
WCF will provide flexibility, since once you want to change the binding or the address, you can do it in the configuration file, instead of doing it by changing the code.

Categories