Could anyone please tell me whether it's possible to reverse engineer (generate interfaces and services) from WSDL.
The reason being, we would like to generate exactly same industry stanadard WSDL.
Any tool to achieve above will be appreciated.
If you mean you want to be able to take a WSDL and run it through some tool to generate a complete service (including the interfaces and the implementation of those interfaces), I don't think there is one.
If you want to generate a proxy to use with a service from its WSDL, you can use the SVCUTIL.EXE tool - ServiceModel Metadata Utility Tool (Svcutil.exe).
Related
Could anyone please let me know how we can check if a particular web-service is REST or SOAP?
I understand that the main difference is the wsdl file, however, even for WCF REST service with webHttpBinding, one has a wsdl file which is generated.
I want to know the best possible ways to identify for a given service, check if it is a REST or SOAP.
Thanks.
Check for WSDL definition. If exists the web service is SOAP. By convention the WSDL file is located on following URL: [webservice_url]?wsdl
P.S. This check will work in most cases, but not all cases. REST web services sometimes are described with WADL (https://www.w3.org/Submission/wadl/)
I'm trying to create some tool for testing WCF services. I'm aware of such products, but the goal is creating of mine one.
Main trouble is in calling wcf methods without having contracts. I've found solutions using scvutil.exe, but I need to make it on the on demand, as soon as I receive service address.
Any advices or links are appreciated.
Thanks.
Visual Studio provides a tool (the WcfTestClient) that will create a proxy for any WSDL based service (it doesn't have to be a WCF service). There are a few limitations with enumerations as data types and a few other quirks but it's a very useful tool. Here is the documentation for the tool.
Is there any possibility as a client to get a list of contracts a WCF host exposes?
I would like to query a service and to ask what interfaces it implements.
Take a look at WCF Discovery.
This is not supported by WCF.
You can query the service's WSDL contract, but not the WCF contracts or any Interfaces.
The best you will be able to do is to see what is exposed, and assume that is the interface. You will not be able to see all the different interfaces that the class implements. For example, if you had a service which implemented IFooService, and IDisposable, with IFooService exposed through WCF, you would be able to see all the methods of IFooService from the client.
The WCF Test utility will take a given wsdl and generate a client for it, looking at the source for that might be a good starting point. (you'll have to decompile it with something like reflector)
Another idea, You could programatically invoke svcutil to generate a client for a given wsdl, then invoke msbuild to compile it, and use reflection to load the output assembly. It would be a fairly large amount of work, and I'm not sure what you would do with it. You would have to build a fairly complex UI to inspect and invoke the client.
In general (web) services are being described by XML-based protocols such as WSDL. This is used both for discovery of the services and for describing their operations. Also UDDI is sometimes used but mostly for Enterprise Application Integration (internal use).
So you can have your WCF service produce WSDL information and let your client query that.
As the question suggests, is providing the WSDL really necessary, or is it more of a "nice to have" feature? I have written a RESTful service, using .Net 4.0. I see now that WSDL isn't automatically generated by adding ?wsdl... and I can't get it to either after trying various suggestions :-/
I have written several ASMX services in the past - all well and good as the WSDL is accessible automatically. I want to move away from SOAP. I would prefer to provide potential users with a Class (C#, Java versions etc..) and sample code. Is that an equally viable option? Or am I being lazy in suggesting all that?
Thanks for your opinions.
WSDL = SOAP;
REST != WSDL;
For a REST Service, WSDL is not a nice-to-have it is a cannot-have.
If you are exposing a RESTful service then WSDL does not mean anything - WSDL means you have a SOAP web service.
You can expose a SOAP web service in addition to your REST service but the WSDL would be for that service.
I have a WCF deployed on IIS. Now by adding web reference of it i am using it on my app.
So I have two questions:
Is it the best method of consuming WCF.
If the answer of first question is yes then what is the role of svcutil.exc, I mean what is the use of creating wcf proxy class. and if the answer is "No" then why?
It is the easiest solution if you develop with visual studio and have access the remote WCF service.
If you are developing using another IDE, you might want to use SvcUtil to generate your proxies.
If you prefer to have a simple CS file containing the generated client, you might also choose to generate it using SvcUtil.
You may also completely ignore SvcUtil and the Service Reference wizard and use the ChannelFactory class to generate proxies dynamically.
You should use "Add Service Reference" in Visual Studio (not Add Web Reference) for WCF.
It is the easiest way - since you can do it right in Visual Studio. What it does under the covers is basically call svcutil.exe (or you can do that manually, from the command line yourself), and create a service proxy class for use on the client side.
The use of svcutil.exe is many fold - you can create a client proxy class from a running service (or from an existing WSDL/XSD file), you can verify services, you can export metadata from a service for clients to consume, and a great many more options. It's the "Swiss Army Knife" of WCF tools.
WCF uses a concept that all calls to your service must go through a client proxy - this is the place where the entire WCF runtime lives, and where all the WCF extensibility points are located. This proxy converts your call to a method on the client into a serialized message that gets sent across the network to the server for processing, and it also handles "unpacking" the response from the call back into classes and objects on your client side for your use.
Adding a service reference is the quickest and easiest way but not always the best way. If you want performance then using ChannelFactory<T> is the way to go. You should know different ways to create a client side proxy and customisations that you can do.
An excellent resource is WcfGuidanceForWpf. Don't let the WPF in it scare you as it is really an excellent guidance for general WCF as well.