Topologi Tool Shop

Your Source for XML Utilities

 

Online demonstration of SOAP validation

The demonstration is available online at http://www.topologi.com/soapdemo.

(Please note that this is not a demonstration of SOAP per se: the Topologi Validating Proxy is not a SOAP forwarder and can validate any kind of XML. This demonstration uses SOAP as a typical kind of application: we can imagine the proxy is sitting in front of some SOAP-aware system which the proxy is gatekeeping. )

Instructions

  • Click "Validate" and the example SOAP document will be validated by the Topologi Validating Proxy; the valid document will be passed on to the ultimate server which generates a positive response.
  • Introduce a well-formedness error (such as adding an extra "<" at the beginning of the text), click "Validate" and the Topologi Validating Proxy will return an error. (The document is not sent to the ultimate server.)
  • (Fix the well-formedness error and) Introduce a SOAP error (such as changing the identifier of a SOAP element in both its start and end-tag or altering the SOAP namespace), click "Validate" and the Topologi Validating Proxy will return an error.
  • (Fix the SOAP error and) You can also validate documents in the more recent SOAP 1.2 format. Go to the Proposed Recommendation for Soap 1.2 and select one of the SOAP examples. Copy it and paste it into the demonstration's text area. Click Validate.

The validating proxy is easy to configure using a single XML file plus the schema files. It does not look over the WWW for schemas and so is safe. When a validity error is found, the validator has many choices of how to log the error, and whether to send the erroneous document on. In this demonstration, an invalid document is not sent to the ultimate server.

This demonstration TVP is set up to validate the elements in the SOAP and XML namespaces only. It can validate SOAP 1.1 or (draft) SOAP 1.2. Proxies can be configured to validate different versions of schemas and different namespaces.

Configuration File

Here is the configuration file used for the demo proxy

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.topologi.com/products/tvp/namespace">
  <proxy>An example proxy </proxy>
    
  <input />
    
  <output>1
    <url>http://www.topologi.com:8080/soapServlet</url>
  </output>
    
  <validate>2
    <wxs>3
       <schemaLocation>4
             http://schemas.xmlsoap.org/soap/envelope/ 
                 /usr/jakarta-tomcat/webapps/tvp/soap1.xsd 
             http://www.w3.org/2002/12/soap-envelope 
                 /usr/jakarta-tomcat/webapps/tvp/w3c-soap.xsd 
              http://www.w3.org/2003/05/soap-envelope
                  /usr/jakarta-tomcat-4.0.4/webapps/tvp/soap-envelope.xsd
             http://www.w3.org/XML/1998/namespace 
                 /usr/jakarta-tomcat/webapps/tvp/xml.xsd
       </schemaLocation>
    </wxs>
  </validate>
    
  <onParseError>5
    <log>
       <file>/usr/jakarta-tomcat/webapps/soapServlet/onParseError.log</file>
    </log>
  </onParseError>
    
  <onError>6
    <log>
       <file>/usr/jakarta-tomcat/webapps/soapServlet/onError.log</file>
    </log>
  </onError>
  
  <onError>7
     <client statusCode="403" statusMessage="SOAP data was not valid." />
  </onError>
</config>

Here is what the significant elements in the configuration file mean:

  • 1 The output element gives the URL of the server.
  • 2 The validate element gives the schemas used for validating.
  • 3 The wxs element specifies that W3C XML Schema validation is being performed. Schematron validation can also be performed.
  • 4 The schemaLocation element specifies the mappings from namespace URIs to WXS schemas. In this case, we validate SOAP 1.1, SOAP 1.2 (draft) and SOAP 1.2 (Proposed Recommendation draft) and elements in the xml: namespace. Other namespaces in the instance document are not validated. The proxy will not download external schemas specified in the instance document.
  • 5 The onParseError element specifies which logging to take when a well-formedness error occurs.
  • 6 The onError element(s) specify which actions to take when a validation error occurs. These may include logging or even transforming the input though a specified XSLT transformation.
  • 7 This onError element specifies that an HTML error message will be returned to the client in the event of a validation error.

UML Activity Diagram of Topologi Validating Proxy