<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" import="org.apache.geronimo.demo.webservices.client.*" %> <%!/* Name of the reference to the Search Phones service described in the web.xml file */ private final static String SERVICE_REF_NAME = "java:comp/env/service/SearchPhones"; /* Used for making hints to users */ private final static org.apache.geronimo.demo.webservices.server.PersonPhone[] AVAILABLE_PHONES = org.apache.geronimo.demo.webservices.server.SearchPhonesServer.AVAILABLE_PHONES; /* Returns the endpoint for calling methods of the web service */ public SearchPhonesPortType getService() throws Exception { javax.naming.InitialContext ctx = new javax.naming.InitialContext(); SearchPhonesService service = (SearchPhonesService)ctx.lookup(SERVICE_REF_NAME); return service.getSearchPhonesService(); }%> <% String name = request.getParameter("name"); %> Web Services Application

Search criterion

Person name: "/>

Hint: the following names are hardcoded:
<% for (int i = 0; i < AVAILABLE_PHONES.length; i++) { %> <%=AVAILABLE_PHONES[i].getPersonName()%><%=(i < AVAILABLE_PHONES.length - 1 ? ", " : " ")%> <% } %>
<% if (name != null && !name.equals("")) { PersonPhone[] foundPhones = getService().search(name); %>

Search results

<% if (foundPhones == null || foundPhones.length == 0) { %> <% } else { %> <% for (int i = 0; i < foundPhones.length; i++) { %> <% } %> <% } %>
No persons which name starts with the specified criterion were found.
The following persons and phones were found:
<%=foundPhones[i].getPersonName()%> <%=foundPhones[i].getPhoneNumber()%>
<% } %>