<%@ page import="org.apache.axis.client.Call, org.apache.axis.client.Service, javax.xml.namespace.QName, java.io.*, java.net.URL, javax.activation.*, org.apache.axis.*, java.util.*, javax.xml.soap.*" %>

<FORM action="http:" method="POST">
LastName: <INPUT type="text" name="lastname"/>
<BR>
<INPUT type="submit" value="Fetch"/>
</FORM>
<HR>
<H4>
<%
			// This example is not intended to be an illustration of good use of JSP concepts.
			// Ideally I would follow MVC (as discussed in Servlets, JSP, Structs and MVC (Part I)
			// at http://www.agiledeveloper.com/download.aspx).
			
			String lastName = request.getParameter("lastname");
			if (lastName != null && !lastName.trim().equals(""))
			{
				DataHandler handler = null;
				String endpoint = "http://localhost:8080/axis/services/Info";
				
				Service service = new Service();
				Call call = (Call) service.createCall();			
				call.setTargetEndpointAddress(new URL(endpoint));

				call.setOperationName(new QName("http://soapinterop.org", "getRecord"));
				String info = (String) call.invoke(new Object[]{lastName});

				call.setOperationName(new QName("http://soapinterop.org", "getFullName"));
				String fullName = (String) call.invoke(new Object[]{lastName});
				
				out.println("Full Name: " + fullName);
				out.print("<BR>");
				out.print("Record: " + info);
				out.print("<BR>");
				out.print("Picture:");
				out.print("<BR>");
				out.println("<img src=\"infoclientPicture.jsp?lastname=" + lastName + "\"/>");
			}
%>
</H4>