I am trying to access a webservice from my server using this tutorial consume web services.. i have been successful in accessing the web service and retrieving a string from it. but in most of the tutorials i have come across we need to give the method names in the web service thru the SOAP actions.. Is there any way in which we can even retrieve the methods that are present in the web service first within our application and then access it using those methods,, so the web service will be more flexible then and we can add more methods later??
You can use WSDL from service and generate proxy. WSDL contains service methods list. Check this
The first thing that springs to mind is to hit the WSDL definition, and search through it for the messages and data types you want.
Related
I need to calling our C# Methods from another server to perform some Action. I use C# in both servers. One is our Service Application, another one is a WPF application where I consume my Service.
Prefer I use a WCF or WebAPI service for Service Application?
Most People prefer to use Web Api, but web doesn't expose metadata for creating proxy by service.
which one is simple and better choose?
You may use either WCF or WebAPI, if multiple platforms (Mobile, Web, Other Service) are going to interact with your service, then I would recommend Web API, otherwise you may use WCF. Similar discussion has already happened in another question, please refer this link, hope this will be useful
Getting a web service and using android to consume them?
I have created a WCF service and I want my client to use servicemethods directly using a URL without creating a proxy class and object for it. How to generate the direct URLs for each webmethod. IF I have 5 webmethods, I want 5 URLS to give to clients to consume.
If you want to call your web service methods without generating the proxy class and object then you should make that service as REST service.
Please look at the below links that will provide you basic idea of what WCF REST Services is.
Beginner Tutorial
step by step REST service
MSDN API for REST service
Is it possible to create a website (hosted locally on my machine is fine for now) using a WCF Service Application?
By "web site" I mean allow an HTTP call from a web browser to my service and have the service return an HTML page that the browser can then render/display.
I am doing something very similar using a WCF based REST service. I have a WCF service that is accessed only from a web browser to download images. If you browse to 'http://www.MyFooImageService.com/100', it will lookup from the database an image with ID 100 and serve it up to the user. I use it to serve images from WCF service for the purpose of sending (user defined) emails with embedded images.
I used this guide with great results: RESTFUL WCF Service Step-ByStep. Check it out and see if a REST based WCF service is what you are looking for.
No, it doesn't quite work like that. WCF applications are service applications. There is no GUI interface or web interface or any kind of interface at all.
What you do is you create a WCF service that does some sort of function. Lets say you create a method called StoreName that stores your name into a database. Keep it simple. WCF services can be hosted in a variety of ways, depending on how you plan to use it. But to keep it simple, lets say you host the application using IIS.
Now this WCF application has no interface for interacting with it. You need to create an ASP.NET application (or it can be PHP, or jQuery if you prefer). It might have a text box and a submit button. Once the submit button is pushed, the ASP.NET application (or jQuery or PHP) makes an ajax call to your WCF service, passing it in the name as a POST parameter. The WCF service then does the work of storing it in the database. Execution then returns back to your web application.
This is a general overview of how this works. I hope it helps!
A website involves:
1) A user requesting HTML from somewhere
You can proxy pass a simple HTTP Get request to a WCF service hosted in a console app (or hosted in IIS), and configure it to return an HTTP request of content type text/html. Then the user would see a website appear in the browser.
But WCF is not a good fit for this. Especially if it's a simple HTML page. Others have said ASP.NET is better for this. And that's true. But node.js or PHP or pretty much anything that isn't .NET is MUCH better for this.
2) A user uses the web page to interact with server processes
This involves a user clicking a button or moving a mouse, or anything, and then that results in the web page (actually a web app at this point) making AJAX requests to one, or several server(s).
WCF is quite a good fit for this.
I have built a web service (WCF) as part of our company product, to support mobile devicies. The service is exposed via SOAP and is consumed by Android and Windows Phone 7 clients. Now we are spreading and need to add support for iPhone clients and those lazy iPhone developers are complaing, that they won't use SOAP, because its terrible, microsoftish, bloatware and there is no sufficient framework for that, etc etc and JSON ftw!
As it is WCF it was easy to create json api for this web service (new interface and little changes in web.config, love WCF!), the only problem is that I am using the built-in WCF Authentication service for authorization and this service is of course exposed via SOAP and I didnĀ“t find a way to make it REST with json. So is there a way to somehow make it RESTful and consume/respond json?
My actual plan is to make another auth service, that will internally just call the existing WCF one via SOAP, but I don't like this workaround. I assume that, if there is not a way to make the WCF one RESTfull, later or sooner, I end up writing the auth service, which in my opinon will not be that hard.
For some reason, I have the idea that a client can ask a WCF service for the request to be of a certain format. Is this possible or do I need to create the same method with different signatures for each different response type?
For instance, if a Silverlight client accesses my WCF service, I want to using binary encoding. However, if my WCF service is called via JQuery or ASP.NET AJAX, I want to return JSON. Is this possible?
Thank you!
You are talking about the binding used, and yes, it is possible to host using multiple bindings. If you're talking about hosting in IIS, and you want binary serialised output, you'll need to be running on Windows Server 2008 and use Windows Process Activation Services (WAS).
You'd be accessing a different endpoint address in each case (e.g. net.tcp://... versus http://...).