X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FEBIFetchClient.java;h=a6c3ed249a5e32d90c36703735e9ab7295ebb8d6;hb=1476221e1c931da67d7c6f189a5d923c63883536;hp=be2f01e4ceac33bcda3c077a3ef33c004d0f3c1f;hpb=fb0b0f2434cf4af0cee7a146bc3d7ef37299a901;p=jalview.git diff --git a/src/jalview/io/EBIFetchClient.java b/src/jalview/io/EBIFetchClient.java index be2f01e..a6c3ed2 100755 --- a/src/jalview/io/EBIFetchClient.java +++ b/src/jalview/io/EBIFetchClient.java @@ -1,160 +1,196 @@ +/* +* Jalview - A Sequence Alignment Editor and Viewer +* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* 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 javax.xml.rpc.ParameterMode; +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ 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; } - } - - 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;} + 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; - - if (s != null) - style = s; + try{ + java.io.PrintWriter out = new java.io.PrintWriter( + new java.io.FileWriter("out.xml")); - call.setOperationName(new QName("urn:Dbfetch", "fetchDataFile")); - call.addParameter("query", XMLType.XSD_STRING, ParameterMode.IN); - call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN); - call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN); + for(int i=0; i