[DAS2] XML-RPC based DAS2 validator

Andrew Dalke dalke at dalkescientific.com
Tue Oct 24 14:03:54 UTC 2006

I've added an XML-RPC service to the DAS validator.  Andreas will be 
to use it to verify new DAS2 entries in his registry.

The entry point to the XML-RPC server is

The trailing "/" is important - use ".../RPC" and the server will do
an HTTP redirect to ".../RPC/", which not all XML-RPC clients 

At present the server implement a single RPC method named 
It takes two positional fields.  The first is the required URL to 
The second is the optional document type to validate against.  If not 
then the server will attempt to guess.

The response is a list of 2-element tuples.  In each pair the first is
the severity level and will be one of

"fatal" means the validator normally should not continue.  I can 
that, which I do in the XML-RPC service in order to generate more 

"error" means the result does not meet the spec but the validator will
continue checking, at least in the normal case.  (That too is 

"warning" is for things which are suspicious but not wrong, like using
"application/xml" instead of the DAS2 content-type, or having a uri 
with an empty content.  (This is legal; it refers to the document 
It's just strange and likely indicates an error in the server.)

The "info" is for niggling details, like that the server guess the 
type (in the case of application/xml response) by looking at the tag for
the top-level element.

Here's an example in Python's interactive shell.  I'll first make a 
to the remote server

 >>> import xmlrpclib
 >>> server = xmlrpclib.Server("http://cgi.biodas.org:8080/RPC2/")

then call the new method with a single parameter; the URL to validate.

 >>> server.validate_url("http://das.biopackages.net/das/genome/human/")
[['info', "Assuming doctype of 'sources' based on Content-Type"]]

That's a list with a single element containing the (severity, message) 
The info statement came because it guessed the document type based on 
content-type from the server.  I can specify the document type directly
and skip that warning statement

 >>> server.validate_url("http://das.biopackages.net/das/genome/human/", 

Here's an example of validating a server with the wrong document type, 
to show
what the error message look like.  I've added newlines so the results 
all on one string

[['fatal', "Received Content-Type 'application/x-das-sources+xml', 
expected 'application/x-das-types+xml'."],
['fatal', "Expected element '{http://biodas.org/documents/das2}TYPES' 
but got '{http://biodas.org/documents/das2}SOURCES' at byte 41, line 2, 
column 2"],
['error', 'element "SOURCES" from namespace 
"http://biodas.org/documents/das2" not allowed in this context at byte 
41, line 2, column 2']]

					dalke at dalkescientific.com

More information about the DAS2 mailing list