Home > Articles > Web Services > XML

How do I validate SOAP-based XML using a schema?

For simple remote method access, you may find it's enough to request a string or an integer and leave it at that. Many of the demonstration language bindings take this approach. But if you're interested in more complex interactions, you'll soon find you want to validate the SOAP-based XML using a schema. It would be even better if the schema conveyed some information regarding the intent of the remote method call. That is, if the remote method adds two integers and returns the result of that addition, you can make use of that information when checking the result or placing reasonable constraints on the input arguments.

This latter intent is the purpose of the Service Description Language, or SDL. SDL actually defines an XML grammar your Web Services use to express their capabilities, allowing them to expose the services they offer so you can better match the service you need.

The following Listing shows you the corresponding SDL that the ASP+ server would use to export the two strings returnable through the HelloWorld class.

Listing  SDL Description of the HelloWorld ASP+ Class

See code:

As you can see from this Listing, the HelloWorld class's description is contained in an XML document bound by the serviceDescription tag. The serviceDescription tag contains several other tags:

  • soap—Describes the SOAP packet itself

  • httppost—The relevant HTTP information for the client's request

  • httpget—The relevant HTTP information for the server's response

  • schema—XML schemas associated with the SOAP data

Essentially, you are scripting the layout of the SOAP packets and telling external clients that you export certain methods composed of certain input and output argument data types.

Source: This FAQ is excerpted from Understanding SOAP by Kennard Scribner and Mark C. Stiver (2000, Sams, ISBN 0672319225). Refer to this book for more detailed information on SOAP.

 

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.