Wednesday, January 27, 2010

Gah! Ontology Lookup Service fails against it's own Schema!!

There is a Ontology lookup service available here:

http://www.ebi.ac.uk/ontology-lookup/

Having a central repository of Ontologies is great idea and I give them kudos for all the hard work.
They advertise a web service  for looking up various Ontologies using the SOAP protocol, which can be found here:

http://www.ebi.ac.uk/ontology-lookup/WSDLDocumentation.do#Link0332BDE0

However, as of today, they have issues with their web service.
I used the wsdl2java utility found with Apache CXF and that generated the stub code successfully.
Using the stub code I threw together some client code to invoke a service. An example is shown below:

package au.edu.apf.phenomebank.ontology;



import java.util.List;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.xml.xml_soap.Map;
import org.apache.xml.xml_soap.MapItem;

import uk.ac.ebi.ontology_lookup.ontologyquery.Query;
import uk.ac.ebi.ontology_lookup.ontologyquery.QueryService;

public class OLSTest {

    public static void main (String[] args) {
        
        
        QueryService ss = new QueryService();
        

        Query ontQuery = ss.getOntologyQuery();
        
        Client client = ClientProxy.getClient(ontQuery);
        client.getInInterceptors().add(new LoggingInInterceptor());
        //client.getInInterceptors().add(new FixInterceptor());
        client.getOutInterceptors().add(new LoggingOutInterceptor());
        
        
        
        System.out.println("Getting ontology names");
        Map ontologyNames =  ontQuery.getOntologyNames();
        
        
        List<MapItem> mapItems = ontologyNames.getItem();
        for (MapItem mapItem : mapItems) {
            Object mapValue = mapItem.getValue();
            System.out.println("mapValue="+mapValue);
        }
    }
    
}

The errors started to happen when I invoked a service call on the stub API:
ontQuery.getOntologyNames();

The following errors were dumped in Eclipse:
DefaultValidationEventHandler: [ERROR]: unexpected element (uri:"", local:"item"). Expected elements are <{http://xml.apache.org/xml-soap}item> 
     Location: line 1
28/01/2010 5:09:52 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
WARNING: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"", local:"item"). Expected elements are <{http://xml.apache.org/xml-soap}item> 

Bascially, it's complaning that the <item>> element is missing the namespace of
http://xml.apache.org/xml-soap 

To verify was wrong I needed to look at the actual SOAP message being sent to me:

  <?xml version="1.0" encoding="UTF-8" ?> 
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <getOntologyNamesResponse xmlns="http://www.ebi.ac.uk/ontology-lookup/OntologyQuery">
- <getOntologyNamesReturn>
- <item xmlns:ns1="http://xml.apache.org/xml-soap" xmlns="">
  <key xsi:type="xsd:string">LSM</key> 
  <value xsi:type="xsd:string">Leukocyte Surface Markers</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">TADS</key> 
  <value xsi:type="xsd:string">Tick Gross Anatomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">FBsp</key> 
  <value xsi:type="xsd:string">Fly taxonomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">FIX</key> 
  <value xsi:type="xsd:string">Physico-Chemical Methods and Properties</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">HOM</key> 
  <value xsi:type="xsd:string">Homology Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">SPD</key> 
  <value xsi:type="xsd:string">Spider Comparative Biology Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">RO</key> 
  <value xsi:type="xsd:string">Multiple Alignment</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">HP</key> 
  <value xsi:type="xsd:string">Human phenotype ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MOD</key> 
  <value xsi:type="xsd:string">Protein Modifications (PSI-MOD)</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">BTO</key> 
  <value xsi:type="xsd:string">BRENDA tissue / enzyme source</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MFO</key> 
  <value xsi:type="xsd:string">Medaka Fish Anatomy and Development</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">TTO</key> 
  <value xsi:type="xsd:string">Teleost taxonomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">WBls</key> 
  <value xsi:type="xsd:string">C. elegans Development</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">APO</key> 
  <value xsi:type="xsd:string">Yeast phenotypes</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MAT</key> 
  <value xsi:type="xsd:string">Minimal Information About Anatomy ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">NEWT</key> 
  <value xsi:type="xsd:string">NEWT UniProt Taxonomy Database</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MI</key> 
  <value xsi:type="xsd:string">Molecular Interaction (PSI MI 2.5)</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">FAO</key> 
  <value xsi:type="xsd:string">Fungal Gross Anatomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">TAIR</key> 
  <value xsi:type="xsd:string">Arabidopsis Development</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">IDO</key> 
  <value xsi:type="xsd:string">Infectious Disease Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">EMAP</key> 
  <value xsi:type="xsd:string">Mouse Gross Anatomy and Development</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">AAO</key> 
  <value xsi:type="xsd:string">Amphibian Gross Anatomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">PRO</key> 
  <value xsi:type="xsd:string">Protein Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">OBO_REL</key> 
  <value xsi:type="xsd:string">OBO Relationship Types</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">ZFA</key> 
  <value xsi:type="xsd:string">Zebrafish Anatomy and Development</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MA</key> 
  <value xsi:type="xsd:string">Mouse Adult Gross Anatomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">XAO</key> 
  <value xsi:type="xsd:string">Xenopus anatomy and development</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">TRANS</key> 
  <value xsi:type="xsd:string">Pathogen transmission</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">PATO</key> 
  <value xsi:type="xsd:string">Phenotypic qualities (properties)</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">TGMA</key> 
  <value xsi:type="xsd:string">Mosquito Gross Anatomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">PRIDE</key> 
  <value xsi:type="xsd:string">PRIDE Controlled Vocabulary</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">REX</key> 
  <value xsi:type="xsd:string">Physico-Chemical Process</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">UO</key> 
  <value xsi:type="xsd:string">Unit Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">CARO</key> 
  <value xsi:type="xsd:string">Common Anatomy Reference Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">SEP</key> 
  <value xsi:type="xsd:string">Separation Methods</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">TAO</key> 
  <value xsi:type="xsd:string">Teleost Anatomy and Development Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MP</key> 
  <value xsi:type="xsd:string">Mammalian Phenotype</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">EV</key> 
  <value xsi:type="xsd:string">eVOC (Expressed Sequence Annotation for Humans)</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">FBdv</key> 
  <value xsi:type="xsd:string">Drosophila Development</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">HAO</key> 
  <value xsi:type="xsd:string">Hymenoptera Anatomy Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MS</key> 
  <value xsi:type="xsd:string">PSI Mass Spectrometry Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">GRO</key> 
  <value xsi:type="xsd:string">Cereal Plant Development</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">EO</key> 
  <value xsi:type="xsd:string">Plant Environmental Conditions</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">PAR</key> 
  <value xsi:type="xsd:string">Protein Affinity Reagents</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">IMR</key> 
  <value xsi:type="xsd:string">Molecule Role (INOH)</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">PSI</key> 
  <value xsi:type="xsd:string">Mass Spectroscopy CV (PSI-MS)</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">PW</key> 
  <value xsi:type="xsd:string">Pathway Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">IEV</key> 
  <value xsi:type="xsd:string">Event (INOH)</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">ECO</key> 
  <value xsi:type="xsd:string">Evidence Codes</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MIAA</key> 
  <value xsi:type="xsd:string">Minimal Information About Anatomy ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">ENVO</key> 
  <value xsi:type="xsd:string">Environmental Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">BS</key> 
  <value xsi:type="xsd:string">Biosapiens Annotations</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">CCO</key> 
  <value xsi:type="xsd:string">Cell Cycle Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">TO</key> 
  <value xsi:type="xsd:string">Cereal Plant Trait</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">FBcv</key> 
  <value xsi:type="xsd:string">Flybase Controlled Vocabulary</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MIRO</key> 
  <value xsi:type="xsd:string">Mosquito Insecticide Resistance</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">WBPhenotype</key> 
  <value xsi:type="xsd:string">C. elegans phenotype</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">CHEBI</key> 
  <value xsi:type="xsd:string">Chemical Entities of Biological Interest</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">DOID</key> 
  <value xsi:type="xsd:string">Human Disease</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">BSPO</key> 
  <value xsi:type="xsd:string">Spatial Reference Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">ZDB</key> 
  <value xsi:type="xsd:string">Zebrafish Anatomy and Development</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">WBbt</key> 
  <value xsi:type="xsd:string">C. elegans gross anatomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">FBbi</key> 
  <value xsi:type="xsd:string">Biological Imaging Methods</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">ATO</key> 
  <value xsi:type="xsd:string">Amphibian Taxonomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">FBbt</key> 
  <value xsi:type="xsd:string">Drosophila Gross Anatomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">SO</key> 
  <value xsi:type="xsd:string">Sequence Types and Features</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">FMA</key> 
  <value xsi:type="xsd:string">Foundational Model of Anatomy Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">EHDA</key> 
  <value xsi:type="xsd:string">Human Developmental Anatomy, timed version</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">ZEA</key> 
  <value xsi:type="xsd:string">Maize Gross Anatomy</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">PM</key> 
  <value xsi:type="xsd:string">Phenotypic manifestation (genetic context)</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">PO</key> 
  <value xsi:type="xsd:string">Plant Ontology (Structure, Growth and Developmental Stage)</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">EFO</key> 
  <value xsi:type="xsd:string">ArrayExpress Experimental Factor Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">GO</key> 
  <value xsi:type="xsd:string">Gene Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">ENA</key> 
  <value xsi:type="xsd:string">European Nucleotide Archive Submission Ontology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">MPATH</key> 
  <value xsi:type="xsd:string">Mouse Pathology</value> 
  </item>
- <item xmlns="">
  <key xsi:type="xsd:string">CL</key> 
  <value xsi:type="xsd:string">Cell Type</value> 
  </item>
  </getOntologyNamesReturn>
  </getOntologyNamesResponse>
  </soapenv:Body>
  </soapenv:Envelope>


The main problem is that nearly all the<item> elements don't have a declared namespace. Here's an example:


<item xmlns="">
  <key xsi:type="xsd:string">HOM</key> 
  <value xsi:type="xsd:string">Homology Ontology</value> 
  </item>

And yet in the WSDL file the schema requires that the namespaces be fully qualified:

  <schema elementFormDefault="qualified" targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://model.web.ook.ebi.ac.uk"/>
   <complexType name="mapItem">
    <sequence>
     <element name="key" nillable="true" type="xsd:anyType"/>
     <element name="value" nillable="true" type="xsd:anyType"/>
    </sequence>
   </complexType>
   <complexType name="Map">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/>
    </sequence>
   </complexType>
   <complexType name="Vector">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType"/>
    </sequence>
   </complexType>
  </schema>

The workaround for this problem was to download the WSDL file and manually change it from qualified to unqualified as follows:



  <schema elementFormDefault="unqualified" targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://model.web.ook.ebi.ac.uk"/>
   <complexType name="mapItem">
    <sequence>
     <element name="key" nillable="true" type="xsd:anyType"/>
     <element name="value" nillable="true" type="xsd:anyType"/>
    </sequence>
   </complexType>
   <complexType name="Map">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/>
    </sequence>
   </complexType>
   <complexType name="Vector">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType"/>
    </sequence>
   </complexType>
  </schema>


More details about this issue can be followed up here:

http://code.google.com/p/ols-ebi/issues/detail?id=6

Hope this helps somebody from the headaches i had to go through to get this working!!

2 comments: