import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import java.io.*;
import java.net.URL;
  
public class Client
{
	public static void main(String [] args) 
	{
		try 
		{
			System.out.print("Enter Person's Last Name:");
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String lastName = reader.readLine();

			String endpoint = "http://localhost/Info/InformationProvider.asmx";
			String callNamespace = "http://www.agiledeveloper.com/ws";
			Service service = new Service();
			String info;
			String fullName;
			{
				Call call = (Call) service.createCall();

				// Begin: Things needed to work with Document-Wrapped literal encoding
				call.setSOAPActionURI("http://www.agiledeveloper.com/ws/getRecord");
				call.setEncodingStyle("");

				call.addParameter(new QName(callNamespace, "lastname"),  
					org.apache.axis.Constants.XSD_STRING, 
					javax.xml.rpc.ParameterMode.IN);
				call.setReturnClass(String.class);

				call.setOperationUse("literal");
				// End: Things needed to work with Document-Wrapped literal encoding

				call.setTargetEndpointAddress(new URL(endpoint));
				info = (String) call.invoke(callNamespace, "getRecord",
					new Object[]{lastName});
			}
			{
				Call call = (Call) service.createCall();
			
				call.setSOAPActionURI("http://www.agiledeveloper.com/ws/getFullName");
				call.setEncodingStyle("");

				call.addParameter(new QName(callNamespace, "lastname"),  
					org.apache.axis.Constants.XSD_STRING, 
					String.class, 
					javax.xml.rpc.ParameterMode.IN);
				call.setReturnClass(String.class);

				call.setOperationUse("literal");
				call.setTargetEndpointAddress(new URL(endpoint));
			
				fullName = (String) call.invoke(callNamespace, "getFullName",
					new Object[]{lastName});
			}
			System.out.println("Details reterived on " + lastName);
			System.out.println("Full Name:" + fullName);
			System.out.println("Information on record: " + info);
		}
		catch (Exception e) 
		{
			System.err.println(e.toString());
		}
	}
}