How to host wcf Routing Service on IIS? - c#

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

Related

Web Service Consumption C#

Hi I have One wsdl file at my local machine. I tried testing it through SoapUI by sending an XML request with Header and SAML token asserted. When i added the WSDL file to my project's web reference, I can see the functions/operation which i want to consume and all its parameter which are to be passed but I cannot find a way to add header and SAML token to it.
Also the URL i have to hit is a HTTPS url so i have to add client Certificates.
All this i have tested over SoapUI and i am getting the response.. Al i want is how to send a request through dotnet code when my WSDL is at local. Since i am working for some Highly secured client i cannot reveal any code. I am posting this question on an assumption that this may be a common problem faced by people.
Please demonstrate your solution with an example.
You should consume your service with Wcf. That will allow you to abstract the transport details away from the client code. With this method you can have separate configurations between the server and client (production using HTTPS, plus no client configuration required, no HTTPS for local dev machine). There are tons and tons of great tutorials on WCF here and on the internet at large, so I'm not going to post a big long example here, but Google is your friend.

How to create a Asmx Client for Wcf Service

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.

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.

How do I get the SOAP headers as XML?

How can I get the SOAP header of my web service function as xml?
I need an XML version of my working SOAP header to use as an example for someone with broken SOAP headers. He's using a different programming language, but since the headers are sent in XML, we're hoping we can compare those easily. I'm using C# and ToString() just gives me the name of the object. After googling, I tried Fiddler, but that didn't catch anything, and SOAP Extensions look way too complicated for what seems like a really simple task.
There is no easy way to do this with ASMX web services. If you were using WCF, it would be a trivial matter of turning on message logging.
Fiddler should catch everything, and it's well worth learning how to use. Be sure to look in the online documentation to learn how to capture traffic from localhost to localhost.
The accepted answer to this question mentions that you can capture traffic to a web service using soapUI. You can use it to act as a proxy or HTTP tunnel in order to capture messages sent to your web service. I think using it in HTTP Tunnel mode makes sense, because then you won't have to do anything with your client other than to point the URL to soapUI instead of your actual service.
The soapUI website talks about the SOAP Monitor feature, though I don't think it offers a good explanation for setting up the HTTP tunnel.
Here are the steps involved (based on soapUI 3.0.1):
Open Soap UI
create a New soapUI Project...
2.1 Give your project a name
2.2 Enter the path to your service's WSDL (http://localhost/.../YourService.asmx?WSDL)
Right-click on the project you just created
Select "Launch SOAP Monitor"
Choose "HTTP Tunnel"
Specify an unused port number for "Port". The default will probably work.
Enter the URL to your web service in "Set endpoint for HTTP Tunnel"
If you are using SSL, then you may need to fill in some of the other fields; otherwise, click OK
The HTTP tunnel is running, so now just reconfigure a client to use the HTTP tunnel instead of the actual web service. So if your actual service is "http://localhost:1234/YourService.asmx", then reconfigure your client to use "http://localhost:{Port}/YourService.asmx" where {Port} is the number you entered in step #6.
Now just run your client normally. You'll see the traffic logged in the soapUI interface. Select a message and click on the "Message Content" button at the bottom of the window to view the actual SOAP message.

Categories

Resources