Generate WSDL for existing SOAP Service using captured traffic

You mentioned this is the SOAP service of a printer. Is the printer’s API documented on the manufacturer’s site? Does the documentation include the WSDL? Can you get the WSDL from the manufacturer?

If you can get the WSDL from the manufacturer then you’re done!

If not, then you have to build the WSDL by yourself because I doubt you can find a tool that generates WSDLs given SOAP samples (when working with SOAP web services you mainly get two kinds of tools: those that generate code from WSDL + those that generate WSDL from code).

It’s not hard to create the WSDL if you are familiar with SOAP, WSDL and XSD. You just need a text editor or maybe even a WSDL editor to speed things up.

If you don’t have full confidence in your WSDL knowledge, there are still some tools that can get you most of the way to the complete WSDL. Here is a way you could do it:

1 – First you need to create the XML schema for the SOAP payloads. For this you can find tools, even some online. After you have the schema, tweak it to your needs by adding, changing or removing elements.

2 – Now you can use the XSD to generate a WSDL. There is an online tool that does that. It just needs the request/response element types to end with Request/Response. Make sure you read the instructions.

You take your XSD file, change the names of the operations to add the Request/Response suffix and feed it to the WSDL Generator – Web Tool. You will get your WSDL.

Now tweak this WSDL as you like (remove the Request/Response suffixes if you don’t need them) then …

3 – … make sure you end up with a valid WSDL.

4 – Now you can take your WSDL and use a tool like SoapUI to generate sample requests and responses from it just to verify that you get the proper results back.

Do the SoapUI messages match the messages you started with? If yes, you are done and can feed the WSDL to suds to create the Linux client. If not, tweak the WSDL until you get the result you are after.

Leave a Comment