X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FEBIFetchClient.java;h=c1a03022661bcd2ebdb52d39094aac4c0bea8888;hb=08044f16da407871ea84ccbfbc09e34cceb74080;hp=3c6e5f9050109f86badd33815603eada6e06b6e4;hpb=99c58ee0ae2a848f982552e53feaf6d5cb9925e5;p=jalview.git diff --git a/src/jalview/io/EBIFetchClient.java b/src/jalview/io/EBIFetchClient.java index 3c6e5f9..c1a0302 100755 --- a/src/jalview/io/EBIFetchClient.java +++ b/src/jalview/io/EBIFetchClient.java @@ -16,166 +16,279 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.io; -import org.apache.axis.client.*; - import java.io.*; -import javax.activation.DataHandler; import org.apache.axis.AxisFault; +import org.apache.axis.client.*; import org.apache.axis.encoding.XMLType; -import javax.xml.rpc.ParameterMode; -import javax.xml.namespace.QName; -import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory; import org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory; +import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory; +import javax.activation.DataHandler; -public class EBIFetchClient -{ - Call call; - String format = "default"; - String style = "raw"; - - public EBIFetchClient() - { - try{ - call = (Call)new Service().createCall(); - call.setTargetEndpointAddress(new java.net.URL( - "http://www.ebi.ac.uk/ws/services/Dbfetch")); - }catch(Exception ex){} - } - - - public String [] getSupportedDBs() - { - try{ - - call.setOperationName(new QName("urn:Dbfetch", "getSupportedDBs")); - call.setReturnType(XMLType.SOAP_ARRAY); - return (String[]) call.invoke(new Object[]{}); - - }catch(Exception ex){return null;} - } - - public String [] getSupportedFormats() - { - try{ - call.setOperationName(new QName("urn:Dbfetch", "getSupportedFormats")); - call.setReturnType(XMLType.SOAP_ARRAY); - return (String[]) call.invoke(new Object[] {}); - - }catch(Exception ex){ return null; } - } +import javax.xml.namespace.QName; +import javax.xml.rpc.ParameterMode; - public String [] getSupportedStyles() - { - try{ - call.setOperationName(new QName("urn:Dbfetch", "getSupportedStyles")); - call.setReturnType(XMLType.SOAP_ARRAY); - return (String[]) call.invoke(new Object[] {}); - }catch(Exception ex){return null;} +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class EBIFetchClient +{ + Call call; + String format = "default"; + String style = "raw"; + + /** + * Creates a new EBIFetchClient object. + */ + public EBIFetchClient() + { + try + { + call = (Call) new Service().createCall(); + call.setTargetEndpointAddress(new java.net.URL( + "http://www.ebi.ac.uk/ws/services/Dbfetch")); + } + catch (Exception ex) + { + } } - public String [] fetchData(String ids, String f, String s) + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] getSupportedDBs() { - // ids should be of the form uniprot:25KD_SARPE;ADHR_DROPS; - // max 50 ids can be added at one time - try{ - call.setOperationName(new QName("urn:Dbfetch", "fetchData")); - call.addParameter("query", XMLType.XSD_STRING, ParameterMode.IN); - call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN); - call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN); - call.setReturnType(XMLType.SOAP_ARRAY); + try + { + call.setOperationName(new QName("urn:Dbfetch", "getSupportedDBs")); + call.setReturnType(XMLType.SOAP_ARRAY); - if (f != null) - format = f; + return (String[]) call.invoke(new Object[] { }); + } + catch (Exception ex) + { + return null; + } + } - if (s != null) - style = s; + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] getSupportedFormats() + { + try + { + call.setOperationName(new QName("urn:Dbfetch", "getSupportedFormats")); + call.setReturnType(XMLType.SOAP_ARRAY); - return (String[]) call.invoke(new Object[] {ids, format, style}); + return (String[]) call.invoke(new Object[] { }); + } + catch (Exception ex) + { + return null; + } + } - }catch(Exception ex){return null;} + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] getSupportedStyles() + { + try + { + call.setOperationName(new QName("urn:Dbfetch", "getSupportedStyles")); + call.setReturnType(XMLType.SOAP_ARRAY); + return (String[]) call.invoke(new Object[] { }); + } + catch (Exception ex) + { + return null; + } } - public String fetchDataFile(String arg, String f, String s) + public static void main (String [] args) { + EBIFetchClient ebi = new EBIFetchClient(); + String[] result = ebi.fetchData("uniprot:25K89D_SARPE;G6PblobD_HUMAN", + "xml", null); - if (f != null) - format = f; + try{ + java.io.PrintWriter out = new java.io.PrintWriter( + new java.io.FileWriter("out.xml")); - if (s != null) - style = s; + for(int i=0; i