Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleClient Stubs Generation
borderStylesolid
<%SERVEER_INSTALLATION_BIN_DIR%>:\ jaxws-tools.bat wsimport -s C:\WSDL httpconverter/converter?wsdl">http://localhost:8080/jaxws8080jaxws-conveterconverter/converter?wsdl
  • Now all the stubs should have been created and placed in C:\WSDL directory. We will be needing only the class ConverterPortType for accessing Web Service.



  • Copy the files Converter.java and ConverterPortTypeObjectFactory.java and place them in the appropriate folder according to their package declaration

...

Code Block
titleresult.jsp
borderStylesolid

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@page import="java.math.BigDecimal"%>
<%@ page import="org.apache.geronimo.samples.jaxws.Converter"%>
<%@ page import="org.apache.geronimo.samples.jaxws.ConverterPortType"%>
<html>
<head>
<title>Converter</title>
<meta content="text/html; CHARSET=iso-8859-1" http-equiv="Content-Type">
</head>
<body>
<%
	String amount = request.getParameter("amount");

	if (amount != null && amount.trim().length() > 0) {

		out.println("<center>");

		try {
			BigDecimal dollars = new BigDecimal(amount);
                        Converter conv = new Converter();
			ConverterPortType port = conv.getConverterPort();
			BigDecimal rupees = convport.dollarToRupees(dollars);
			BigDecimal euros = convport.rupeesToEuro(rupees);

			out.println(dollars + " Dollars equals to " + rupees
					+ " Rupees");
			out.println("<br>");
			out.println(rupees + " Rupees equals to " + euros
					+ " Euros");

		} catch (Exception e) {
			out.println("Error: " + e.getMessage());
		}

		out.println("<center>");
	}
%>
</body>
</html>

...

Code Block
titleModified result.jsp
borderStylesolid
........
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="javax.naming.Context" %>
........
Context ctx= new InitialContext();
Object obj = ctx.lookup("java:comp/env/services/Converter");
Converter service= (Converter) obj;
ConverterPortType port = service.getConverterPort();
BigDecimal rupees =port.dollarToRupees(dollars);
BigDecimal euros = convport.rupeesToEuro(rupees);
........

...