65

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?

5
  • 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? stackoverflow.com/questions/1952015/…
    – Jontatas
    Apr 23, 2014 at 8:32
  • 1
    Because there is a requirement to create xml using xsd of a wsdl. Apr 23, 2014 at 10:22
  • 10
    You can extract the XSD which is either imported or embedded in the <types/> 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 <types/>. Apr 23, 2014 at 13:36
  • 4
    BTW, XJC code generator can handle WSDL directly: stackoverflow.com/questions/15903249/…
    – Vadzim
    Aug 10, 2015 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. Dec 10, 2019 at 11:43

6 Answers 6

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!

7
  • 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 <wsdl:types> element as suggested in @helderdarocha's comment (which seems correct)?
    – Anentropic
    Jan 28, 2015 at 15:27
  • 8
    Yeah, I just copy-paste. Maybe there is a more elegant way to do it?
    – D2TheC
    Feb 19, 2015 at 9: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 <wsdl:types> 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 1, 2016 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, 2016 at 8:00
  • 2
    There is no "Schemas" tab Oct 23, 2019 at 9:12
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

5
  • 44
    It only exports the WSDL, not the XSD files. (using SoapUI 5.2.1) perhaps I'm doing something wrong?
    – BitfulByte
    Nov 16, 2015 at 7:18
  • 2
    @Raj, which version of SoapUI you are referring here ?
    – Sam
    Dec 7, 2015 at 7:23
  • 1
    @PimHazebroek I have added a screenshot for reference , I am using SoapUI 5.4.0
    – Raj
    May 22, 2019 at 13:10
  • 3
    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: <?xml version="1.0"?> Jan 10, 2020 at 19:49
  • In SoapUI 5.7 it generates a detached XSD file Nov 4, 2022 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).

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/">
0

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

1
  • 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.
    – Community Bot
    Apr 19, 2023 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!
2
  • As in other answers, different versions of SoapUI do not export the XSD in this way, which version are you using?
    – iBobb
    Jan 19, 2023 at 14:56
  • I've followed your steps and not reached anywhere in SoapUI 5.7.0
    – Shad
    Mar 31, 2023 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.