tags:

views:

1072

answers:

2

I have an wsdl file that describes a group of objects, but I want to extract the definition just from a subset of them, is this possible, and if so what's the best way to achieve this? My goal is to generate an XSD schema for that subset.

What if you are not using the WSDL generation tools in .NET? Is there a good way to accomplish this using other tools? I am using Java, trying to interface with a web service. I have a library for manipulating xml documents, which requires an xsd. I also have a library for simple SOAP interactions, which makes using Axis overkill. It would be great if I could easily extract an XSD from the WSDL.

A: 

I am assuming you are talking about wsdl generation in ASP.NET

in ASP.NET a wsdl file is automatically generated through reflection. That means that every web method of the assembly will be mapped when you use:

http://mysite/myservices.asmx?wsdl

A workaround to circunvent this limitation would be:

1.disable default documentation generation in web.config

<webServices>
  <protocols >
    <remove name="Documentation"/>
  </protocols>
</webServices>

2.create your own wsdl file with the .net wsdl.exe tool and edit the generated wsdl for the subset you need.

wsdl.exe http://mysite/myservices.asmx?wsdl

3.publish your modified wsdl:

http://mysite/myservices.wsdl

As a final advice. If possible move to WCF wich provide a finer control over web services .

P.D. Say hi to Mario for me ;-)

Igor Zelaya
+1  A: 

If you know precisely what objects you want to extract from the schema you could take the wsdl file, run it through a XSL tranformation to keep the pieces you want (or remove the things you don't).

Adam Hawkes