/* XspanSoapClient.java version 1 * * Copyright (c) all rights reserved xspan.org, december 2004 */ package org.xspan.client; import org.xspan.webService.*; import java.util.Vector; import java.io.*; /** * Class to test the XSPAN axis webservice access * * @author kcm, xspan.org */ public class XspanSoapClient { public XspanSoapClient() { } /** * will return list of organisms in database * * @return each element in array will be name of organism in the database */ public String[] getOrganisms() { String answer[] = null; try { org.xspan.webService.XspanService service = new org.xspan.webService.XspanServiceLocator(); org.xspan.webService.Xspan xs = service.getxspan(); answer = xs.getOrganisms(); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } return answer; } // end getSpecies() /** * will return the names of the high-level structure mapping types * * @return each element in array is a name */ public String[] getMappingTypes() { String[] answer = null; try { org.xspan.webService.XspanService service = new org.xspan.webService.XspanServiceLocator(); org.xspan.webService.Xspan xs = service.getxspan(); answer = xs.getMappingTypes(); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } return answer; } // end getMappingTypes /** * will return a list of subtypes based on a high-level mapping type from getMappingTypes * *@param in the type you wish the subtypes for, will come from output of * getMappingTypes() * * @return each element in array is the name of a subtype */ public String[] getMappingSubTypes(String in) { String[] answer = {"empty"}; try { org.xspan.webService.XspanService service = new org.xspan.webService.XspanServiceLocator(); org.xspan.webService.Xspan xs = service.getxspan(); answer = xs.getSubMappingTypes(in); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } return answer; } // end getMappingSubTypes /** * will return the anatomy of the organism you specify * * @param in the name of the organism you want the anatomy for * * @return an Anatomy object containing the organism's anatomy, look * at wsdl file for details of Anatomy object */ public org.xspan.webService.Anatomy getAnatomy(String in) { org.xspan.webService.Anatomy answer = new org.xspan.webService.Anatomy(); try { org.xspan.webService.XspanService service = new org.xspan.webService.XspanServiceLocator(); org.xspan.webService.Xspan xs = service.getxspan(); answer = xs.getAnatomy(in); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } return answer; } // end getAnatomy /** * method to get mappings * * @param id the tissue id you wish to find mappings for eg FBbt:0001234 * @param species the organism you want to find mappings in. this can be * specified eg "Celegans" or can be "none" * @param type the type of mapping you want to search for. this can be * "ALL" or one of the names returned from the getSubMappingTypes * * @return an array of Mapping objects with each element being a single Mapping between * two structures, see wsdl file for more details on Mapping.java */ public org.xspan.webService.Mapping[] getMapping(String id, String species, String type) { org.xspan.webService.Mapping[] map = new org.xspan.webService.Mapping[1]; try { org.xspan.webService.XspanService service = new org.xspan.webService.XspanServiceLocator(); org.xspan.webService.Xspan xs = service.getxspan(); map = xs.getMappings(id, species, type); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } return map; } // end getMapping /* * used to test above methods */ public static void main(String[] args) { XspanSoapClient dem = new XspanSoapClient(); System.out.println("Test getOrganisms:"); String[] answer = dem.getOrganisms(); System.out.println("Length of answer: "+answer.length); for(int i=0; i