63

Is there any way by which I can generate xsd from wsdl. Any link or tool will also do. What is the simplest way to do this?

Filburt
  • 17,626
  • 12
  • 64
  • 115
user3365075
  • 713
  • 1
  • 8
  • 11
  • You can generate XML from WSDL as the WSDL is a specification for a service. Converting to XSD sounds strange though. Why would you want to do that? http://stackoverflow.com/questions/1952015/what-is-the-difference-between-xsd-and-wsdl – Jontatas Apr 23 '14 at 08:32
  • 1
    Because there is a requirement to create xml using xsd of a wsdl. – user3365075 Apr 23 '14 at 10:22
  • 10
    You can extract the XSD which is either imported or embedded in the `` element in the WSDL. If it's imported, you just have to get the URL (and possibly calculate the absolute path, if it is relative). If it is embedded, extract the contents of ``. – helderdarocha Apr 23 '14 at 13:36
  • 4
    BTW, XJC code generator can handle WSDL directly: http://stackoverflow.com/questions/15903249/generate-classes-with-jaxb2-maven-plugin-from-wsdl – Vadzim Aug 10 '15 at 10:38
  • I stuck too long on this task. It's not hard to convert by hand, but there is a tool for it (XMLSpy). It is also possible to evaluate the tool for 30 for free. – Pete Ythong Dec 10 '19 at 11:43

6 Answers6

51

You can use SoapUI: http://www.soapui.org/ This is a generally handy program. Make a new project, connect to the WSDL link, then right click on the project and say "Show interface viewer". Under "Schemas" on the left you can see the XSD.

SoapUI can do many things though!

D2TheC
  • 2,203
  • 20
  • 23
  • 9
    I can't find an option to export XSD from this tool... do you just mean to use it as a WSDL viewer and use it to copy and paste the content of `` element as suggested in @helderdarocha's comment (which seems correct)? – Anentropic Jan 28 '15 at 15:27
  • 8
    Yeah, I just copy-paste. Maybe there is a more elegant way to do it? – D2TheC Feb 19 '15 at 09:08
  • 4
    Awesome. I tried using the svcutil.exe and it generated schemas but multiple XSD files not just one XSD file as a client requested. Just copying and pasting from SOAPUI (again the stuff between the tags) and saving that as an XSD file worked beautifully. No fooling around with coda obscura like what flags/params to use with the Microsoft tools. No merging files. Copy, paste, save, done. Thanks for the info. SOAPUI is a great tool. – infocyde Mar 01 '16 at 18:29
  • 3
    In case this is a problem for anyone else reading, the copy-paste to new file doesn't always create a consistent schema. It works for small, single-schema WSDL files. However, on a WSDL I've been provided with (by a 3rd party), there are 6 different Schemas without related import statements. So I guess the quality of this solution depends on the quality of the WSDL provided. – DrUseful Dec 15 '16 at 08:00
  • 2
    There is no "Schemas" tab – Mukhamedali Zhadigerov Oct 23 '19 at 09:12
  • 1
    This application has changed a lot since this answer it is likely moved – D2TheC Oct 24 '19 at 09:03
  • 2
    This does not work with SOAP 5.7.0 – Andrew Niken Aug 10 '22 at 12:47
21

Follow these steps :

  1. Create a project using the WSDL.
  2. Choose your interface and open in interface viewer.
  3. Navigate to the tab 'WSDL Content'.
  4. Use the last icon under the tab 'WSDL Content' : 'Export the entire WSDL and included/imported files to a local directory'.
  5. select the folder where you want the XSDs to be exported to.

Note: SOAPUI will remove all relative paths and will save all XSDs to the same folder. Refer the screenshot : enter image description here

Raj
  • 497
  • 4
  • 8
  • 42
    It only exports the WSDL, not the XSD files. (using SoapUI 5.2.1) perhaps I'm doing something wrong? – BitfulByte Nov 16 '15 at 07:18
  • 2
    @Raj, which version of SoapUI you are referring here ? – Sam Dec 07 '15 at 07:23
  • 1
    @PimHazebroek I have added a screenshot for reference , I am using SoapUI 5.4.0 – Raj May 22 '19 at 13:10
  • 2
    In SoapUI 5.5 the option only generates one wsdl file, you can proceed with a dirty copy-paste operation to get the scheme definition inside: `wsdl:definitions -> wsdl:types -> xs:schema` and create a new file with **xsd** extension. Add the first line if is necessary: `` – Jairo Martínez Jan 10 '20 at 19:49
  • In SoapUI 5.7 it generates a detached XSD file – Rubens Amaral Nov 04 '22 at 12:04
2

(WHEN .wsdl is referring to .xsd/schemas using import) If you're using the WMB Tooklit (v8.0.0.4 WMB) then you can find .xsd using following steps :

Create library (optional) > Right Click , New Message Model File > Select SOAP XML > Choose Option 'I already have WSDL for my data' > 'Select file outside workspace' > 'Select the WSDL bindings to Import' (if there are multiple) > Finish.

This will give you the .xsd and .wsdl files in your Workspace (Application Perspective).

Varun
  • 77
  • 3
0

Once I found an xsd link on the top of the wsdl. Like this wsdl example from the web, you can see a link xsd1. The server has to be running to see it.

<?xml version="1.0"?>
<definitions name="StockQuote"
             targetNamespace="http://example.com/stockquote.wsdl"
             xmlns:tns="http://example.com/stockquote.wsdl"
             xmlns:xsd1="http://example.com/stockquote.xsd"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns="http://schemas.xmlsoap.org/wsdl/">
snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
0

You can Use utilityarena.com it has a free utility to convert complex wsdls to xsd

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 19 '23 at 13:00
-1
  1. Soap ui -> New SOAPUI project -> use wsdl to create a project (lets assume we have a testService in it)
  2. you will have a folder called TestService and then inside it there will be tokenTestServiceSoapBinding (example) -> right click on it
  3. Export definition -> give location where you need to place the definition.
  4. Exported location will have xsd and wsdl files. Hope this helps!
Barani r
  • 2,119
  • 1
  • 25
  • 24
  • As in other answers, different versions of SoapUI do not export the XSD in this way, which version are you using? – iBobb Jan 19 '23 at 14:56
  • I've followed your steps and not reached anywhere in SoapUI 5.7.0 – Shad Mar 31 '23 at 12:27