Java Reference
In-Depth Information
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
//service instance injected...
Catalog port = service.getCatalogPort();
String title = port.getTitle("12345");
try {
out.println("<html>");
out.println("<head>");
out.println("<title>WebServiceRef Test</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Title= " + title + "</h1>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}
}
}
The servlet itself contains the reference to the generated SEI proxy instance, and the container
does the injection as it would with any other injectable resource.
The following is the client that can invoke this web service using an SEI generated from a call
to wsimport :
CatalogService svc = new CatalogService();
Catalog port = svc.getCatalogPort();
return port.getTitle("12345");
Figure 6-1 shows the output in a browser window.
Search WWH ::




Custom Search