4

Probably is a straight-forward question: do you know any tools for combining multiple wsdl + xsd files into a single wsdl?

Thank you.

Edit1: The service is a WCF service, and I want to have a single wsdl for PHP (as client).

Edit2: Too bad I need to use .Net 4.0 and not 4.5 where this would be possible. Maybe I could borrow then one of the new MS tools? Do you know which one? Is the svcutil.exe the responsible tool? If yes, what are his dependencies? Because I don't want to jump to .Net 4.5 just yet.

Learner
  • 3,297
  • 4
  • 37
  • 62

3 Answers3

0

We wanted one wsdl file to make use of some tools to automatically generate soap proxy on PHP side. But we ended up writing the DTO layer manually.

If you have wcf service in .NET 4.5 you can get easily only one wsdl file (inbuilt feature of WCF framework).

Learner
  • 3,297
  • 4
  • 37
  • 62
0

You can build a small application that can generate a flat wsdl. We do generate flat wsdl programatically in C# for building interoperable WCF services. Refer to the link on how to generate flat wsdl.

Hopefully seeing the code you can build a tool that does it for you.

Else you can manually do it using Altova Xml Spy and replacing the xsd import attributes by the xsd schema definition.

Rajesh
  • 7,766
  • 5
  • 22
  • 35
  • I tried WCFExtras, but doesn't work since it requires to have only one wsdl file and I have nested services with different namespaces. E.g: ConcreteService: IService, which IService: IServiceBase... IService and IServiceBase have different namespaces . Do you think this "FlatWsdl" works in my case? – Learner Mar 06 '12 at 11:08
  • Btw I need this in order to use it from PHP – Learner Mar 06 '12 at 12:11
  • If you are using .NET 4.5 you have a inbuilt feature of WCF framework to generate single wsdl files. Else you need to build you own custom service factory. Regarding different namespace for your interface if you can invoke the same with a .NET client then generating a single flat wsdl should work as well. And flat wsdls are needed when you want your WCF service to be consumed by non .NET clients – Rajesh Mar 06 '12 at 13:38
  • *"flat wsdls are needed when you want your WCF service to be consumed by non .NET clients"* is not necessarily true; Java-based tooling, as an example, is able to consume any valid WSDL, no matter how many WSDL and external XSD files are involved. – Petru Gardea Mar 06 '12 at 14:06
  • @PetruGardea: Yes, agree that it is not always true, but using flat wsdl makes your service consumable by most of the Client (kind of all) – Rajesh Mar 06 '12 at 14:13
  • I would argue this point from a best practice perspective; for anything but trivial, I would rather consider this a bad thing; XSDs should live outside WSDLs; there are too many tasks and separation of responsibilities in the enterprise that wouldn't work otherwise. To achieve reuse, I've seen many recommendations, particularly now with SOAP 1.1 and SOAP 1.2 bindings, that would tell you to stick with 3 WSDL file format (messages - ports - services). When we're talking clients on platforms that play catch up, then you could do refactoring, but that should be the exception, not the norm... – Petru Gardea Mar 06 '12 at 14:39
  • We didn't have issues with Java and gSoap so far. Only PHP complains so far with having multiple wsdl files when we want to generate some classes. – Learner Mar 06 '12 at 15:09
  • Try exposing a different endpoint which uses the custom service host and generates flat wsdl that can be used by your php client – Rajesh Mar 06 '12 at 15:20
  • @Rajesh: So you think it will work. Ok, will try it. I thought the term "flat" refers to put xsd files together in one wsdl and "merge" term to combine multiple wsdl files into a single one. That's why I hesitated to use it. – Learner Mar 06 '12 at 15:28
  • Do you know which MS tool (from Net 4.5 SDK) could help me? – Learner Mar 06 '12 at 15:32
  • Check this link : http://blogs.msdn.com/b/piyushjo/archive/2011/10/05/what-s-new-in-wcf-4-5-flat-wsdl-support.aspx – Rajesh Mar 06 '12 at 15:43
  • I was looking for the tool only, since I don't want to have 4.5 just yet. Is this svcutil.exe ? Or 4.5 is mandatory? – Learner Mar 06 '12 at 15:45
  • For that feature you need to have v4.5 installed and build your service using v4.5 else you need to write your own service host factory and use that in your .svc file – Rajesh Mar 06 '12 at 15:46
0

For sure, I can recommend a tool that can combine multiple XSD files into the minimum set possible (I am biased here, since I wrote it). This in itself can be a heavy task, if you have a large number of files, many namespaces, or both. The things might get trickier for multiple WSDLs into one, depending on some parameters you may have configure; for example, is it logically one WSDL authored over three layers that maintains separation of messages - portTypes - services, or multiple WSDLs, period? One thing you must ensure is that all share the same types subsystem, there's no conflict for operations, etc. But even this is a task that could be achieved, I could easily put an addon out... If this is refactoring of XML Schemas and WSDLs you see doing often, let me know.

Petru Gardea
  • 21,373
  • 2
  • 50
  • 62
  • ok, will give it a try (btw, your website is very slow and it requires me to register?) – Learner Mar 06 '12 at 12:36
  • @Cristi, yes, it does need registration for support and automatic updates; as for being slow, might've been a glitch, seems ok now. I noticed you posted after that you need to use it from PHP... mine is rather a standalone app running on desktop. Take a look at this [post](http://stackoverflow.com/questions/8896602/the-minoccurs-attribute-cannot-be-present) for an idea on XSD refactoring; if you wish to continue without registration, send me an email using the support address on the web site and I'll set up a download link without you registering. – Petru Gardea Mar 06 '12 at 13:55