00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 package msd_soap_service_pkg;
00016
00017
00018 import org.apache.axis.client.Call;
00019 import org.apache.axis.client.Service;
00020 import org.apache.axis.encoding.XMLType;
00021 import org.apache.axis.utils.Options;
00022
00023 import javax.xml.namespace.QName;
00024
00025 import javax.xml.rpc.ParameterMode;
00026
00028
00029 import msd_soap_types.*;
00030 import msd_soap_types.holders.*;
00032
00033 import org.apache.axis.message.SOAPBodyElement;
00034
00036
00037
00038
00039
00040
00041 import java.net.URL;
00042
00043
00044
00045
00046
00047
00048 public class ApiClient
00049 {
00050
00051
00052 public static void main(java.lang.String [] args)
00053 {
00054 try {
00055
00056 Options options = new Options(args);
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 java.lang.String endpointURL = "http://parrot.ebi.ac.uk:8100";
00070
00071 long before = System.currentTimeMillis();
00072
00073 Service apiserver = new Service();
00074 Call connect = (Call) apiserver.createCall();
00075 Call resultset = (Call) apiserver.createCall();
00076 Call query = (Call) apiserver.createCall();
00077 Call exec_query = (Call) apiserver.createCall();
00078
00079 connect.setTargetEndpointAddress( new java.net.URL(endpointURL) );
00080 resultset.setTargetEndpointAddress( new java.net.URL(endpointURL) );
00081 query.setTargetEndpointAddress( new java.net.URL(endpointURL) );
00082 exec_query.setTargetEndpointAddress( new java.net.URL(endpointURL) );
00083
00084
00085
00086
00087 connect.addParameter( "conn-name", XMLType.XSD_STRING, ParameterMode.IN );
00088 connect.addParameter( "host", XMLType.XSD_STRING, ParameterMode.IN );
00089 connect.addParameter( "usern", XMLType.XSD_STRING, ParameterMode.IN );
00090 connect.addParameter( "pass", XMLType.XSD_STRING, ParameterMode.IN );
00091 connect.addParameter( "status",XMLType.XSD_INT,ParameterMode.OUT);
00092 connect.setReturnType( org.apache.axis.encoding.XMLType.XSD_INT);
00093
00094 resultset.addParameter( "conn-name", XMLType.XSD_STRING, ParameterMode.IN );
00095 resultset.addParameter( "query-name", XMLType.XSD_STRING, ParameterMode.IN );
00096 resultset.addParameter( "res-name", XMLType.XSD_STRING, ParameterMode.IN );
00097 resultset.addParameter( "nors",XMLType.XSD_INT,ParameterMode.IN);
00098 resultset.addParameter( "status",XMLType.XSD_INT,ParameterMode.OUT);
00099 resultset.setReturnType( org.apache.axis.encoding.XMLType.XSD_INT);
00100
00101 query.addParameter( "conn-name", XMLType.XSD_STRING, ParameterMode.IN );
00102 query.addParameter( "query-name", XMLType.XSD_STRING, ParameterMode.IN );
00103 query.addParameter( "result-name", XMLType.XSD_STRING, ParameterMode.IN );
00104 query.addParameter( "status",XMLType.XSD_INT,ParameterMode.OUT);
00105 query.setReturnType( org.apache.axis.encoding.XMLType.XSD_INT);
00106
00107
00108
00109
00110 exec_query.addParameter( "conn-name", XMLType.XSD_STRING, ParameterMode.IN );
00111 exec_query.addParameter( "query-name", XMLType.XSD_STRING, ParameterMode.IN );
00112 exec_query.addParameter( "result-name", XMLType.XSD_STRING, ParameterMode.IN );
00113 exec_query.addParameter( "buf", XMLType.XSD_STRING, ParameterMode.IN );
00114 exec_query.addParameter( "stm", XMLType.XSD_STRING, ParameterMode.IN );
00115 exec_query.addParameter(new javax.xml.namespace.QName("", "status"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"), int.class, javax.xml.rpc.ParameterMode.OUT);
00116 exec_query.addParameter(new javax.xml.namespace.QName("", "rs"), new javax.xml.namespace.QName("urn:msd_soap_types", "queryResp"), msd_soap_types.QueryResp.class, javax.xml.rpc.ParameterMode.OUT);
00117 exec_query.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
00118 exec_query.setUseSOAPAction(true);
00119 exec_query.setSOAPActionURI("");
00120 exec_query.setOperationStyle("rpc");
00121 exec_query.setOperationName( "msd-exec-query");
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 java.lang.Integer ConnOutParam=new java.lang.Integer(0);
00133 java.lang.Integer ResultOutParam=new java.lang.Integer(0);
00134 java.lang.String connname = "MyConnection";
00135 java.lang.String queryname = "MyQuery";
00136 java.lang.String resname = "MyResult";
00137
00138
00139
00140
00141
00142 java.lang.Integer nors = new java.lang.Integer(2);
00143 java.lang.String sql = "select * from WHOUSE1.atom_data where atom_id >= 2010000*:f<int> and atom_id <= 2010300*:f<int>";
00144 java.lang.Integer buf = new java.lang.Integer(50);
00145
00146
00147 connect.setOperationName( "msd-connect");
00148 resultset.setOperationName( "msd-resultset");
00149 query.setOperationName( "msd-query");
00150
00151
00152
00153
00154 javax.xml.rpc.holders.IntHolder status= new javax.xml.rpc.holders.IntHolder();
00155 msd_soap_types.holders.QueryRespHolder rs = new msd_soap_types.holders.QueryRespHolder();
00156
00157
00158 java.lang.Integer connret=(java.lang.Integer)connect.invoke(new java.lang.Object[]{connname});
00159 java.lang.Integer resultret=(java.lang.Integer)resultset.invoke(new java.lang.Object[]{connname,queryname,resname,nors});
00160 java.lang.Integer queryret=(java.lang.Integer)query.invoke(new java.lang.Object[]{connname,queryname,resname});
00161 java.lang.Object exec_queryret= exec_query.invoke(new java.lang.Object[]{connname,queryname,resname,buf,sql});
00162
00163 if (exec_queryret instanceof java.rmi.RemoteException) {
00164 throw (java.rmi.RemoteException)exec_queryret;
00165 }
00166 else {
00167 java.util.Map _output;
00168 _output = exec_query.getOutputParams();
00169 try {
00170 status.value = ((java.lang.Integer) _output.get(new javax.xml.namespace.QName("", "status"))).intValue();
00171 } catch (java.lang.Exception _exception) {
00172 status.value = ((java.lang.Integer) org.apache.axis.utils.JavaUtils.convert(_output.get(new javax.xml.namespace.QName("", "status")), int.class)).intValue();
00173 }
00174 try {
00175 rs.value = (msd_soap_types.QueryResp) _output.get(new javax.xml.namespace.QName("", "rs"));
00176 } catch (java.lang.Exception _exception) {
00177 rs.value = (msd_soap_types.QueryResp) org.apache.axis.utils.JavaUtils.convert(_output.get(new javax.xml.namespace.QName("", "rs")), msd_soap_types.QueryResp.class);
00178 }
00179 }
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 System.out.println("\nConnection Return: " + connret);
00202 System.out.println("\nResult Set Return: " + resultret);
00203 System.out.println("\nQuery Return: " + queryret);
00204
00205
00206 long after = System.currentTimeMillis();
00207
00208 long time = after-before;
00209 System.out.println("\nTime taken = "+ time);
00210
00211 } catch (Exception e) {
00212 System.err.println(e.toString());
00213 e.printStackTrace();
00214 }
00215 }
00216 }