54

Is there a way to generate Request & Response XML formats from just a WSDL file - if the webservice is not live right now.

SoapUI doesn't give me the response unless it contacts the Webservice with a request. Is there any other tool which can do this?

I should assume this information is available - because without it - client stub frameworks like Axis/JAXWS etc won't be able to generate stubs for generating the requesting and then interpreting the response.

user93353
  • 13,733
  • 8
  • 60
  • 122

5 Answers5

51

Try this online tool: https://www.wsdl-analyzer.com. It appears to be free and does a lot more than just generate XML for requests and response.

There is also this: https://www.oxygenxml.com/xml_editor/wsdl_soap_analyzer.html, which can be downloaded, but not free.

ifnotak
  • 4,147
  • 3
  • 22
  • 36
Siderite Zackwehdex
  • 6,293
  • 3
  • 30
  • 46
39

I use SOAPUI 5.3.0, it has an option for creating requests/responses (also using WSDL), you can even create a mock service which will respond when you send request. Procedure is as follows:

  1. Right click on your project and select New Mock Service option which will create mock service.
  2. Right click on mock service and select New Mock Operation option which will create response which you can use as template.

EDIT #1:

Check out the SoapUI link for the latest version. There is a Pro version as well as the free open source version.

ifnotak
  • 4,147
  • 3
  • 22
  • 36
  • 4
    Nice! I never would have discovered that without reading this response – Abacus Aug 31 '17 at 13:59
  • 2
    SoapUI is by far a better tool for WSDL files and a lot more, this should be the accepted answer! – ifnotak Apr 05 '19 at 11:07
  • 1
    I also used SoapUI (OpenSource version) and found it very easy and intuitive to get it working, specially with the Request Editor. – Telmo Dias Jan 17 '20 at 22:40
9

Doing this yourself will give you insight into how a WSDL is structured and how it gets your job done. It is a good learning opportunity. This can be done using soapUI, if you only have the URL of the WSDL. (I'm using soapUI 5.2.1) If you actually have the complete WSDL as a file available to you, you don't even need soapUI. The title of the question says "Request & Response XML" while the question body says "Request & Response XML formats" which I interpret as the schema of the request and response. At any rate, the following will give you the schema which you can use on XSD2XML to generate sample XML.

  1. Start a "New Soap Project", enter a project name and WSDL location; choose to "Create Requests", unselect the other options and click OK.
  2. Under the "Project" tree on the left side, right-click an interface and choose "Show Interface Viewer".
  3. Select the "WSDL Content" tab.
  4. You should see the WSDL text on the right hand side; look for the block starting with "wsdl:types" below which are the schema for the input and output messages.
  5. Each schema definition starts with something like <s:element name="GetWeather"> and ends with </s:element>.
  6. Copy out the block into a text editor; above this block add: <?xml version="1.0" encoding="UTF-8"?> <s:schema xmlns:s="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  7. Below the block of copied XML, add </s:schema>
  8. Decide if you need "UTF-16" instead of "UTF-8"
  9. The "s:" and the "xmlns:s" should match the block you copied (step 5)
  10. Save this file with ".xsd" extension; if you have "XML Copy Editor" or some such tool (XML Spy, may be) you should check that this is well-formed XML and valid schema.
  11. Repeat for all "element" items in the right hand pane of soapUI until you reach
  12. This way you'll get some type definitions you might not be interested in. If you want to pick and choose, use the following method: Look through the "wsdl:operation" items under "wsdl:portType" in the WSDL text below the type definitions. They will have "wsdl:input" and "wsdl:output". Take the message names from "wsdl:input" and "wsdl:output". Match them against "wsdl:message" names which will likely be above the "wsdl:portType" entries in the WSDL. Get the "wsdl:part" element name from "wsdl:message" item and look for that name as element name under "wsdl:types". Those will be the schema of interest to you.

You can try above procedure out using the WSDL at http://www.webservicex.com/globalweather.asmx?wsdl

MikeC
  • 960
  • 1
  • 7
  • 15
6

Parasoft is a tool which can do this. I've done this very thing using this tool in my past work place. You can generate a request in Parasoft SOATest and get a response in Parasoft Virtualize. It does cost though. However Parasoft Virtualize now has a free community edition from which you can generate response messages from a WSDL. You can download from parasoft community edition

Samuel Garratt
  • 301
  • 3
  • 5
2

Since you are saying the webservice is not live right now, you can do it by creating mockservices which will create the sample response format.

ChanGan
  • 4,254
  • 11
  • 74
  • 135
  • Why is it necessary for the webservice to be live? All tools which generate stubs (like axis, jax-ws etc) are able to generate the stubs with just a wsdl file - so why is a live service necessary? – user93353 Mar 16 '16 at 12:49
  • Basically it is sending request to the server (end point) and it should process the request and should return a response.. If service is NOT live, then the client will send a request but the server will not return a response as it is not running and it will produce a timeout error.. – ChanGan Mar 16 '16 at 12:52
  • If axis/jaxws are able to generate stubs which can understand the response without the service being live, then why would a tool not be able to generate a sample response xml without the service being live. – user93353 Mar 16 '16 at 12:57
  • I am telling from my understanding.. Soap UI is a tool which acts as a client it is nothing other than that.. It just sends the request and will wait for response. it does not produce any result as long as server react. – ChanGan Mar 16 '16 at 13:01
  • I am not asking about SoapUI in particular - I am asking if any tool is available which can do this? – user93353 Mar 16 '16 at 13:11
  • What the frameworks do is what I described in my answer; they do it programmatically. Of course, they also do additomal stuff like generating source code with native data structures and so on. Did you try the answer I gave below? – MikeC Mar 16 '16 at 23:48