Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validating SOAP messages

I can't get any SOAP messages to validate as valid XML. For example, I took the SOAP message below off of Wikipedia and it failed the Validome validator. Is the validator wrong or is there a mistake in the SOAP file? If the validator is wrong can you suggest another? It should take schemas into account. For example, W3C says that this xml is well-formed, but it actually is horribly invalid as Validome correctly points out.

<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
  <soapenv:Header>
    <wsa:ReplyTo>
      <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
    </wsa:ReplyTo>
    <wsa:From>
      <wsa:Address>http://localhost:8080/axis2/services/MyService</wsa:Address>
    </wsa:From>
    <wsa:MessageID>ECE5B3F187F29D28BC11433905662036</wsa:MessageID>
  </soapenv:Header>
  <soapenv:Body>
    <req:echo xmlns:req="http://localhost:8080/axis2/services/MyService/">
      <req:category>classifieds</req:category>
    </req:echo>
  </soapenv:Body>
</soapenv:Envelope>
like image 866
Ben McCann Avatar asked Feb 26 '26 04:02

Ben McCann


2 Answers

The XML you posted might be perfectly valid - if you had specified the location of the schemas with which to validate it.

"Valid" in XML terms means "valid according to a set of XML Schemas". In the absence of any schemas, the concept of validity makes no sense.

like image 186
John Saunders Avatar answered Mar 03 '26 13:03

John Saunders


The following SOAP message validates:

<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
  <soapenv:Header>
    <wsa:ReplyTo>
      <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
    </wsa:ReplyTo>
    <wsa:From>
      <wsa:Address>http://localhost:8080/axis2/services/MyService</wsa:Address>
    </wsa:From>
    <wsa:MessageID>ECE5B3F187F29D28BC11433905662036</wsa:MessageID>
  </soapenv:Header>
  <soapenv:Body>
    <req:echo xmlns:req="http://localhost:8080/axis2/services/MyService/">
      <req:category>classifieds</req:category>
    </req:echo>
  </soapenv:Body>
</soapenv:Envelope>
like image 29
Ben McCann Avatar answered Mar 03 '26 13:03

Ben McCann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!