7

I'm building a WCF router which needs to act as a proxy for a number of internal web services (WCF and ASMX). The routing part is fairly straight-forward, but I can't understand how the service metadata exchange would work in this solution.

In other words: how would a client obtain metadata for an internal service behind the router? Do I need to manually supply WSDL files to the consumer? Can I somehow setup the router to return the metadata for an appropriate internal service?

Or perhaps my architecture is completely wrong?

Ilya Ayzenshtok
  • 721
  • 2
  • 7
  • 18
  • 2
    Not confident enough to post it as an answer, but I do believe manually supplying the WSDL files is the way to go; AFAIK there is no easy way to directly route the metadata. Someone asked [a smilar question on msdn](http://social.msdn.microsoft.com/Forums/en/wcf/thread/b31891be-98d3-4440-a617-f584435b01aa) and got a similar answer (maybe you had already seen that). – Jeroen Nov 05 '12 at 18:35
  • 2
    Yeah, I've seen most of those answers. I've actually succeeded in having an additional route to pull metadata directly from the service, but that introduced new difficulties - for instance, WSDL from the service points to the internal service address. I'm researching further options, and will post it here once I have something. – Ilya Ayzenshtok Nov 06 '12 at 08:26

3 Answers3

4

I see 2 options here:

  1. It may be an option to create a "non-transparent" proxy, if you don't want to expose the internal addresses. The advantage is that you can do more than just routing messages (i.e. such proxy may serve as a "security boundary", unwrapping ciphered messages and passing them plain to the internal endpoint). It can also provide an "interoperable level", exposing a WCF service as simple SOAP using same datatypes/message XML structure. The downside is that you'll have to update its code along with the proxied services
  2. You may implement a WSDL rewriter. With it, you can mask the internal service URL on-the-fly - depending on your conditions, a simple string replace may or may not suffice.

Refer to:

Jeroen
  • 60,696
  • 40
  • 206
  • 339
DarkWanderer
  • 8,739
  • 1
  • 25
  • 56
  • How does this help with obtaining metadata for an internal service behind the router? You're providing decent info but I don't quite see how this answers the question? – Jeroen Nov 12 '12 at 13:20
  • What I'm trying to say is that you can either replace the internal endpoint with an external one (which will also fit the architecture OP described), or you can rewrite the WSDL on-the-fly, replacing the internal links with external ones where needed. You can route metadata, but for the client to connect to the WCF router only without pulling WSDL from original service, some additional steps are needed. – DarkWanderer Nov 12 '12 at 13:45
  • Actually, IWsdlExportExtension will be an even better way to go than message inspector. Answer edited. – DarkWanderer Nov 12 '12 at 13:49
1

The same "router service" can also be used to get the individual WSDL for internal services behind the router.

Check out this thread

Community
  • 1
  • 1
Mike
  • 106
  • 1
  • 5
0

Have you considered using a simple HTTP Proxy instead? All WCF using REST or SOAP are at their core HTTP requests. It seems like the routing functionality (which I am assuming you are basing on hostname, URL path or parameters) could be performed by proxying the HTTP request without needing to understand the contents. ASP.Net will do a fairly good job of sanitizing incoming requests on its own, but you could always add additional custom filtering as necessary.

saarp
  • 1,931
  • 1
  • 15
  • 28