Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

msdsoapTest.java

00001 //---------------------------------------------------
00002 // msdsoapTest.java
00003 // 
00004 // Project: PDBe API Framework 
00005 // Module:  Java Client example for PDBe API Webservice (SOAP) Server 
00006 //
00007 // 
00008 // SOAP User Layer
00009 // Last updated: 25 February 2004 10:17
00010 // (C) Siamak Sobhany
00011 //---------------------------------------------------
00012 // 
00013 package msd_soap_service_pkg;
00014 import java.lang.*;
00015 import java.util.*;
00016 import java.io.*;
00017 import java.net.URL;
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 import org.apache.axis.AxisFault;
00023 import javax.xml.namespace.QName;
00024 import javax.xml.rpc.ParameterMode;
00025 import org.apache.axis.message.SOAPBodyElement;
00026 import org.apache.axis.message.*;
00027 
00028 public class msdsoapTest
00029 {
00030     public static void main(String [] args) throws Exception  {
00031       try {
00032                 long start = System.currentTimeMillis();
00033         // Make a service
00034         Msd_soap_service api_service = new Msd_soap_serviceLocator();
00035  
00036         // Now use the service to get a stub which implements the SDI.
00037         Msd_soap_servicePortType api_port = api_service.getmsd_soap_service();
00038                 java.lang.String ssmQuery ="<SSMInput>" +
00039         "<program>" +                                                             
00040                   "SSM v1.38 // 30/06/2003 // by Eugene B. Krissinel," +                  
00041                   "European Bioinformatics Institute, Hinxton, Cambridge CB1 9SD, UK" +   
00042                 "</program>" +                                                            
00043                 "<query>" +                                                               
00044                 "<type>PDB entry</type>" +                                                
00045                 "<pdbcode>1sar</pdbcode>" +                                               
00046                 "</query>" +                                                              
00047                 "<target>" +                                                              
00048                 "<type>PDB archive</type>" +                                              
00049                 "</target>" +                                                             
00050                 "<selection>" +                                                           
00051                 "<type>Chain(s)</type>" +                                                 
00052                 "<chains>*(all)</chains>" +                                               
00053                 "</selection>" +                                                          
00054                 "<percent1>70</percent1>" +                                               
00055                 "<percent2>70</percent2>" +                                               
00056                 "<sepchains>Yes</sepchains>" +                                            
00057                 "<connectivity>Yes</connectivity>" +                                      
00058                 "<bestmatch>Yes</bestmatch>" +                                            
00059                 "<uniquematch>Yes</uniquematch>" +                                        
00060                 "<precision>Normal</precision>" +                                         
00061                 "<sorting>RMSD</sorting>" +                                               
00062                 "</SSMInput>";                                                                                
00063         java.lang.String sessionID = "my_java_session_number";
00064                 java.lang.Object[] inputArray = new java.lang.Object[2];
00065             inputArray[0]= ssmQuery;
00066                 inputArray[1]= sessionID;
00067             int numOfParams = 2;
00068         
00069                 //java.lang.Object resp;
00070         try
00071           { api_port.msdSSM(numOfParams, inputArray);
00072                 System.out.println("msdSSM() method Called successfully.");
00073                 
00074                 byte[] buffer = api_port.msdGetSoapBase64Data( 0 , sessionID);
00075                 System.out.println("msdGetSoapBase64Data() method Called successfully.");
00076                 
00077                 ByteArrayInputStream ba = new ByteArrayInputStream(buffer);
00078                 //int c = ba.count;
00079                 FileWriter fout = new FileWriter("myjavaout.xml");
00080                 int asc;
00081                 int i =0;
00082                 while (i < buffer.length)
00083                 {asc = ba.read();
00084                  fout.write(asc);
00085                  i++; 
00086                 }
00087                 ba.close();
00088                 fout.close();
00089                 
00090                 long finish = System.currentTimeMillis();
00091             long time = finish-start;
00092             System.out.println("Time taken = "+ time + " milliseconds.");
00093                 } // end try
00094         catch (AxisFault f){
00095                  System.out.println(f.getFaultString());
00096                  
00097         }
00098  } // end try
00099  catch (Exception e) {
00100             System.err.println(e.toString());
00101             e.printStackTrace();
00102       }
00103     }}

Generated on Fri Apr 16 13:47:45 2004 for MSDAPI by doxygen 1.3.4-20031005