// WE ARE USING APACHE AXIS (http://ws.apache.org/axis/) TO HANDLE ALL THE SOAP

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import java.util.Hashtable;

// AN EXAMPLE CLASS THAT SENDS TWO QUERY PARAMETERS (ORGANISM AND MPATH ID) TO PATHBASE AND OUTPUTS IMAGE NUMBERS AS RESULT

public class Pathbase2SOAPClient_SearchPathbase
{
	public static void main(String [] args)
	{
		try
		{
			//CREATE A WEB SERVICE OBJECT WITH THE SPECIFIED URL
			
			String endpoint =
				"http://pathbase1.pdn.cam.ac.uk/axis/Pathbase2_SOAP.jws";
			Service  service = new Service();
			Call     call    = (Call) service.createCall();
			call.setTargetEndpointAddress( new java.net.URL(endpoint) );
			call.setOperationName(new QName("http://pathbase1.pdn.cam.ac.uk/", "searchPathbase") );
			
			
			// CREATE THE HASHTABLE WITH THE QUERY ARGUMENTS
			
			Hashtable query=new Hashtable(1);
			query.put("organism","Rat");
			query.put("mpath","458");

			
			// SEND THE HASHTABLE TO  THE WEB SERVICE AND OUTPUT THE RESULT
			
			String[] ret=(String[])call.invoke(new Object []{query});
			String n1 = (String)ret[1];
			String n2 = (String)ret[2];
			String n5 = (String)ret[0];
			System.out.println(n1+"|"+n2+"|"+n5);

		}
		catch (Exception e)
		{
			System.err.println(e.toString());
		}
	}
}