My company currently have web services written in WCF in C#, I have been asked to adjust my interface to interact with the web services, the interface is written in PHP/HTML. It will be running VIA IIS as well as the services.
Is this possible or do I need to tell me boss we need to go back to the drawing board
WCF Services can be accessed by any other application that is built on any platform and using any programming language.Web services are interoperable.
You can either expose a REST endpoint:
http://msdn.microsoft.com/en-us/magazine/dd315413.aspx
Or just put a ASP.Net Web API in front of your WCF service to act as a middle man:
http://www.asp.net/web-api
In php there are a number of ways of talking to a RESTful service, here is one library that can help:
http://phphttpclient.com/
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 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 designing an Android application which is supposed to connect to a server via WCF web service.
I have a WCF web service written in .NET 4.5 and it is a self-hosted web service. It has SOAP endpoint configuration and it is not a very complex service, however it does include some methods which return DTOs (Classes containing lists, other DTOs and value types).
Now the problem I am facing is that I wish to use some sort of tools to consume the web service definition and generate the proxy classes. I have been successful doing this with the help of Eclipse, but the resulting generated code uses alot of external libraries not available within Android.
Now my question is, what are the preferred tools/methods to consume WCF SOAP web services?
I found that using the following tool gave me the best generated code.
https://code.google.com/p/android-ws-client/
I do recommend this tool to anyone looking for consuming a WCF SOAP web service.
I've been trying to find a tutorial on here, MSDN, and Google on how to implement my own SOAP API. I have an application written in C# that I want to be consumable by PHP so that calls from the web can interact with the application. How do I generate and tie a WSDL file to my application so that it can be communicated with over SOAP calls? Any suggestions?
I think for this you just need to create WCF service in .net that will allow you to consume server from any language.
Create an ASP.Net Web Services .wsdl file to communicate with the various applications. Host the Web Service on windows IIS server and configure the ports accordingly, then you can access the endpoints to whcih ever application you are using, using the address and the web method name.
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.