This might be a simple question, but is it possible to use a windows service as a tier between my code and a webservice?
I have a rather large project, and a webservice. Instead of calling the WS directly, I need a tier inbetween. (There are reasons to why that's a good idea...)
Since a windows service is all ready present, can I call that service, and get that same service to call the webservice?
You could use wcf to communicate with a windows service, that than communicates with a webservice.
Or you could host a web service in the windows service, that communicates with the original webservice.
That are just two examples, so it es technical possible to match you requirements.
Related
I know that ASP.net web service supports only HTTP protocol and with WCF you have more options like TCP and Named pipes etc. Can you think of any scenarios in which one might have to consume a WCF service through an ASP.net Web API?
Following would be one of them use case where you want to call wcf service from web API.
If you already have a wcf service running and available which is doing some complex operations and you do not want it to be available directly to your consumers, you can create a web API and call the wcf service to perform the complex tasks and let the consumers to use the web API. In web API you can put extra logic of validation and authorization of the incoming requests.
Wcf being an older technology it would be better to write something new and eventually replace wcf rather than maintaining it.
Also If the current wcf is setup is not available via http protocol then not all the clients can communicate with it. Web API has that edge over wcf service.
How web API would connect to wcf service?
This depends on lot of factors such as network, deployment strategy, security etc.
But following would be one of the examples.
If the wcf service is available on tcp and web API and wcf are running on the same network, then web API can call wcf.
There may be a different answer to this question based on what exact problem you are trying to solve.
My answer is based on what information you have provided and the experience I gained by solving similar issue in real life.
I need to make a WPF application running under a regular account and a windows service that will run under the admin account. The WPF application will call a service that then performs the required tasks.
What I'm dealing with is the way of communication between these two elements. Mostly I came across references to WCF and named pipes with which I do not have much experience.
So I thought I would create a self-hosting owin web api and use it instead of WCF.
I would therefore like to ask what are the disadvantages of such a solution. Is the use of a self-hosted web api suitable for such purposes, or I would rather use WCF named pipes.
Thanks for any advice :-)
I am working on a Visual Studio Application that references a WCF web service, and after some reading online I am pretty confused.
I have read that WCF is a framework for building a web service, but it is not an API. Is this true?
I was under the impression that Web Services are APIs; I always thought that APIs were Software as a Service (SaaS). Doesn't that mean that APIs and Web Services are pretty much the same thing? Or do I have the wrong idea?
Could this be a misconception of my understandings of SOAP and REST?
Basically I want to know whether a WCF built web service counts as an API, and why/why not?
WCF is an API that can be used to create APIS within your application.
Web Services usually involves creating an API within your application. There are valid APIs that are not Web Services, like the Win32 API.
Its possible to build a WCF web service with one web method for an application that would not be considered an API specifically since it does not contain a set of routines, protocols, or tools for building applications.
Review http://en.wikipedia.org/wiki/Application_programming_interface for what an API is.
According to wikipedia, yes, yes it is:
APIs often come in the form of a library that includes specifications
for routines, data structures, object classes, and variables. In other
cases, notably SOAP and REST services, an API is simply a
specification of remote calls exposed to the API consumers.
An API (Application Program Interface) is a way to interact with components of a system. It defines the operations that can be used to get data out or push it in.
WCF (Windows Communication Foundation) itself is a framework for building web services and other applications that need a communication channel to share data with other services/applications, it is actually a lot larger on what it can do. You can read more about it on MSDN. It is an API as it gives you objects that allow you to tell it interact with its' components.
REST and SOAP are just architecture styles that can be used to serve data via a service, it is defining how you should interact with the data rather than the components themselves.
I am create an iPhone app that needs to talk to a Windows C# app. The app will run as either a Service or Form Application.
What would be the best way to accomplish this? Ideally exposing a service-type architecture would be best as I don't need a stateful connection (stateless is fine in this case).
Can a WCF service hosted by my app using a form of TCP binding be consumed by my iPhone? Or can an app host using httpBinding without the aid of IIS or some other web server?
To run WCF on iPhone you need MonoTouch. Currently, which isn't completely implemented.
I don't think it's a good idea.
Web Service are a better idea in my opinion. You can spawn a web service listener from your console/gui/service Windows C# application.
Here's what I ended up doing:
In my .NET windows service, I created WCF service bound using a WebHttpBinding endpoint. Doing so exposed my WCF services as JSON.
From the iPhone, using Objective-C, I used the ASIHTTPRequest and json-framework libraries to talk to and parse the JSON web service exposed by my .net app.
Expose your C# application functionality as a ReSTful web service. More information on exposing WCF service is available here
And there are project templates available for creating REST WCF service. Download the WCF REST starter kit.You can expose your service in XML/JSON format.
Then from your iPhone app, you may consume the web service exposed.
I recently wrote a wrapper (C#) for an ApplinX web service - this is a product that is part of the Software AG Adabas offering. The web service interface is really primitive and I wrote the wrapper to make it easier to use.
The wrapper is in use on web applications (C# + Asp.Net) but I want to a Windows client to access it using WCF. Would it be better to write the WCF services from scratch or simply wrap the existing wrapper in WCF?
Is the wrapper in a seperate class library? If not, you can move the wrapper into a class ibrary and allow both the ASP.NET app and the windows client app to consume it. This would eliminate any adition wrappers and abstraction layers. It would also allow the windows client to directly consume the service without having to go through the ASP.NET application.
If you wrap the current wrapper in as a WCF service, then from the windows client, you will be making a service call to your ASP.NET app, which will turn around and make another call to the service it is consuming. The above recommendation will eliviate that. If however there is some business logic you need to encapsulate and only want to be on the server, then I would create a WCF service on the ASP.NET application and wrap the calls to your wrapper service in that. The Windows client can then consume the WCF service.