3
votes

I have a very simple SOAP XML, received from a WSDL-based web service, as a response to a SOAP request:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <PingResponse xmlns="http://somevalidnamespacedomain.org/xyz">
         <PingResult>Pinging Back</PingResult>
      </PingResponse>
   </soap:Body>
</soap:Envelope>

This SOAP XML validates perfectly in soapUI (the tool used to receive this message). That is, if I right-click the message pane in soapUI and select 'Validate' from the context menu, it displays a "Validation OK".

enter image description here

But if I copy & paste the same exact message to Notepad++ (or even to Altova's XMLSpy), then attempt to validate (pointing to the correct .xsd), I receive a not-so-clear error message:

Validation of current file using XML schema:

ERROR: Element '{http://schemas.xmlsoap.org/soap/envelope/}Envelope': No matching global declaration available for the validation root.

Why does this happen?

What do I need to wrap it with (or modify) in order to make it validate outside soapUI?

2
What xsd file are you using to validate the SOAP xml request? the PingResponse xsd file? - majimenezp
@majimenezp Yes, PingResponse.xsd but it shouldn't matter in this case because validation fails way before reaching the <PingResponse> element. It fails right at the beginning, at the <soap:Envelope> element. Funny thing is, soap:Envelope's namespace is provided on the same exact line... Also, the aforementioned SOAP message was provided as an example. All SOAP messages fail that validation. - Withheld

2 Answers

1
votes

I'm guessing that when validating, you point your validator to schema document that has definitions for the soap body but does not have definitions for for the soap envelope structure. Therefore your validation fails already on the root element.

Note that (especially) if you tell your validator to use some certain schema file, it doesn't know and it is not even interested in what purpose your XML document is for. It just checks the grammar and tries to validate the whole document (unless the schema document tells to skip the contents of some elements).

1
votes

try to define the soap envelope schema location in the root element. Some like this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">