How to create a Asmx Client for Wcf Service - c#

I have some clients calling my asmx service and I figure out to change my asmx to a Wcf service.
How can my asmx clients call to my Wcf service without modify the client application?
Maybe just a few changes in the config file...
I can't expect than they compile their applications.

The following article illustrates a detailed guide on how you could achieve that.

You need to support basicHttpBinding in your WCF server and provide new URL to your basicHttpBinding endpoint to callers.
Callers only need to change URL they use.
Everything should happen behind the scene for them.

Related

Why does WCF bear the complexity of client proxies when in restful environment it can be much simpler?

I have not configured an environment before. However, I have worked in an environment which is restful and basically calling the service was as bare-bone as calling the service URL using AJAX calls from the javascript.
Now, I am in a WCF environment and I am laying out the service here. It sounds like WCF requires a lot of configuration on the client side including a client proxy class (I guess for each service that we want to call?)
This is a lot of boilerplate code that I am going to write here. That is fine but out of curiosity I am just wondering that what is advantage of using WCF and its client Proxies as oppose to simple RestFUL AJAX calls which will return JSON objects to your Javascript. Also this produces more questions like:
Can I use WCF with javascript/AJAX environment? Because there is no way that Javascript is going to be able to create a proxy for it
Even ASMX model was not requiring proxy. Then why WCF added this proxy? what advantage does WCF/proxy have compared to ASMX without any proxy?

How to host wcf Routing Service on IIS?

So this is in relation to my question here.
So I have an existing wcf service running already, hosted on IIS. I created a Router Service that will do some XPath filtering on the header. So if the header is match then go to service1.
Now, I hosted my Router Service on IIS and I can access it like http://iis.com/myrouter/router.svc/ and give me this wsdl stuff. Now when I try to request a service method on service1 like this http://iis.com/myrouter/router.svc/general/getMyMethod?blah=blahblah. It gives me a 404 error. I used fiddler by the way.
On my request through fiddler I added my custom header like "service_version:1". I used a namespace by the way on my <namespaceTable> but I don't know how to append it on my request. Anyway, my main concern is how can I make my Router Service work on IIS?
Update: I am using System.ServiceModel.Routing.RoutingService by the way. So what I am trying to accomplish is Routing Services.
Your help is greatly appreciated.
You are likely facing this. A SOAP service can't be accessed that way because it relies on the SOAP package. Here is another article that should lead you down the right direction. However, the direction it leads you down is that testing a SOAP service by hand is not to be desired and probably a futile effort.
However, one note is that it leads you to use the WCF Test Client - that's the best direction to go my friend and it's very easy to use. Provide the URL and it will do the rest.
Invoke soap wcf service in Fiddler like in Wcf test client
Accessing the RESTful Endpoint
If you're trying to test the RESTful endpoint then the issue is likely surrounding the routing that is configured. Please refer to this link for assistance - make sure you're setting up your service the same because the attributes they use build the routing properly. Remember that you're not going to reference the RESTful endpoint with the same address as the SOAP endpoint.
http://geekswithblogs.net/michelotti/archive/2010/08/21/restful-wcf-services-with-no-svc-file-and-no-config.aspx
You can also check out this link.
Hosting WCF soap and rest endpoints side by side

How to setup WCF proxy relay service

I am writing an ASP.net Dashboard application in C#. The application will collect alarm statistics and display them on the dashboard via Ajax(jQuery).
The application could collect the alarm stats cross domain so we chose to set it up as follows:
A standalone Windows Service runs with a constant connection to the Broker(a program that collects stats). Inside the Windows Service we've hosted a WCF service. The windows service will load pass the string of stats into the WCFExternalService.
We then setup an WCF Service hosted in IIS and referenced inside the Client app( this service will act as a relay/proxy service).
Can someone please point me to an article or explain how to setup the bindings/endpoints to connect the proxy service to the external WCF service?
Thanks in advance for any help on this!
Larry
Looks like you have already got most of the structure going. My inputs below:
The WCF proxy (in UI layer) could implement the same service contract as its WCF service counterpart (in Windows service). However, the WCF proxy would be a 'client' of the real WCF service (you need to configure this in Web.config).
Now, enable the WCF proxy to be consumed by jQuery / JavaScript using WebInvoke attribute. [WebInvoke("GET", WebMessageBodyStyle.WrappedRequest, ResponseFormat:=WebMessageFormat.Json)]
Use jQuery $.ajax syntax to consume your WCF proxy. The url should be an equivalent of 'http://myHost/myVirtual/MyProxy.svc/MyMethod' and the data should be a JSON string equivalent of your WCF proxy parameters.
Further explanation on the first point:
This MSDN article explains how to set up a WCF client (to be consumed by your proxy WCF).
Next, you can create a proxy WCF service to consume the WCF client.
The Web.config of your website (which contains the proxy) needs sections for WCF client and WCF proxy.
Hosting does not matter in WCF, so your 'real' service could support any binding (Http, Tcp) based on your requirements and environment

Can I expose a service with REST & SOAP via WCF?

I want to architecture our software so that we can expose our API logic using WCF (SOAP and REST).
Im confused as to whether I have to use ASMX files if I want to do SOAP services, or whether .svc file can still do SOAP service?
Yes you can. You have to expose a SOAP end-point for your WCF service. This MSDN post has an example.
Your svc file can provide the restful interface you are requesting. You just have to do a little configuring within your web configuration file, and decorate the svc class with the attributes to describe the behavior of our restful url.
here is a great article going over the steps:
http://www.dotnetfunda.com/articles/show/779/simple-5-steps-to-expose-wcf-services-using-rest-style

Soap Webservice Transparent WSDL change

I have a webservice [call it S1] exposed and clients call that service and get back response.So good so far.
I have to change my WSDL a bit [for some very odd reasons] but i dnt want clients to see the change. So my idea is to intercept the soap request somewhere b/w server and client and interceptor should modify the soap request and forward to the server.Similarly on response , again interceptor should intercept the request and change some property name and send it to the client.
Any idea how to do this? One approach IMO is to use handlers but here i dont have control over how server generates service from WSDL.
How can ESB help in this?
Please see its realtime application with huge requests to and from server!!!
An ESB like Mule ESB can help by acting as a proxy for your web service.
Can you not write a new web service with the new wsdl, then alter the old web service to simply call the new web service. A bit like overloading a method. That way you can have V1 and V2 web services.

Categories

Resources