// 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 AN IMAGE NUMBER TO PATHBASE AND DISPLAYS THE IMAGES WIDTH AS RESULT

public class Pathbase2SOAPClient_GetImageDetails
{
	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", "getImageDetails") );
			
			
			//SPECIFY ALL THE FIELDS THAT YOU WANT TO OUTPUT HERE
			
			call.addParameter("image_width",
					org.apache.axis.Constants.XSD_STRING,
					javax.xml.rpc.ParameterMode.IN);

					
			// SPECIFY THE IMAGE NUMBER YOU WANT TO GET THE DETAILS FOR
			
			Integer i1 = new Integer(34);
			
			
			// WE ARE RECEIVING A HASHTABLE AND OUTPUT THE RESULTS
			
			call.setReturnClass(Hashtable.class);
			Hashtable ret = (Hashtable) call.invoke( new Object [] { i1});
			String n = (String)ret.get("image_width");
			System.out.println("Image 34 width = " + n);

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