1

I have, in the context of a SOAP request,

  • a WSDL
  • a bunch of XSDs, referenced by the WSDL
  • an example SOAP request

I would like to validate that the SOAP request fits the WSDL and all the XSDs.

I am specifically looking for a dead simple (as in lines-of-code) way using existing gems. I know, in principle, how to do it myself by extracting all the XSDs from the WSDL and validating the XML against the XSDs myself (with nokogiri, for example), but in the context of this question I am specifically looking for something as easy as

require 'wonderful_validator'
WonderfulValidator.validate(xml, wsdl)

The validator should be able, given that it can find all the files in the proper manner of course, to do everything needed to decide whether the XML fits the WSDL and all the XSDs. Including the SOAP header/body message structure.

Similar to Java. Validate SOAP message against a WSDL or http://www.soapui.org/apidocs/com/eviware/soapui/impl/wsdl/support/wsdl/WsdlValidator.html or https://www.codeproject.com/Articles/182406/Validating-SOAP-Message-against-WSDL , just in ruby.

AnoE
  • 8,048
  • 1
  • 21
  • 36
  • Sine this is an ask for a resource, it might get closed. But [Savon](http://savonrb.com/) does all this stuff automatically. – Mark Thomas Jul 07 '17 at 18:04
  • I am, coincidently, using Savon in some projects, but I saw it as a SOAP client so far and was not aware that it can validate existing XML requests. Or did you mean the feature that it is able to parse the WDSL to *generate* requests? – AnoE Jul 07 '17 at 19:58
  • An identical question: https://stackoverflow.com/questions/29240559/validate-xml-response-against-wsdl-using-ruby-savon – Mark Thomas Jul 11 '17 at 11:48
  • @MarkThomas, well, similar. That other question limits itself to Savon specifically, I am open to everything. But it seems like there is not really a good solution yet. – AnoE Jul 11 '17 at 12:25
  • I thought Savon automatically validated a request against the WSDL. Not sure how exposed that functionality is for a la carte usage, though. – Mark Thomas Jul 11 '17 at 13:27

1 Answers1

0

There is a gem called wsdl_validator that pretty much tries to validate the SOAP request against WSDL before sending. However in my case , it fails to identify multiple schemas defined inside the WSDL.

In response to other people here: No, Savon does not automatically validate.

hc_dev
  • 8,389
  • 1
  • 26
  • 38
  • Be more specific in your answer, so it could be read as solution without knowing the details of the question (I edited `do it` to `validate the SOAP request against WSDL`). I also added links, since your _gem_ seems a good solution to follow up. – hc_dev Nov 27 '19 at 19:10