Listing 1.

<%@ LANGUAGE = JScript %>

<%
soapServer = Request("soapServer");
if (soapServer.count > 0 && soapServer == "java")
{
   title = "ASP to Servlet Interaction";
   wsdl = "http://localhost:8080/iSoap/javaServer/WeatherService.wsdl";

   useJavaServer = "checked='checked'";
   useMsServer = "";
}
else
{
   soapServer = "ms";
   title = "ASP to ASP SOAP Interaction";
   wsdl = "http://localhost/iSoap/msServer/WeatherService.WSDL";

   useJavaServer = "";
   useMsServer = "checked='checked'";
}

%>

<%
where = Request("city");
condition = "";
if (where.count > 0)
{
   service = Server.CreateObject("MSSOAP.SoapClient")
   service.ClientProperty("ServerHTTPRequest") = true
   service.mssoapinit(wsdl, "", "", "");
   try
   {
      condition = service.getCondition(where);
   }
   catch (exc)
   {
      condition = exc.description;
   }
}
else
{
   where = "";
}
%>

Listing 2.

import java.util.Random;

public class Weather
{
	private static String[] conditions =
	{
		"Sunny", "Partly cloudy",
		"Partly sunny", "Cloudy", "Precipitation"
	};

	public String getCondition(String where)
	{
		Random weather = new 
     Random(where.hashCode());
		int w = 
     weather.nextInt(conditions.length);

		return conditions[w];
	}
}

Listing 3

<%@ page import="java.net.URL" %>
<%@ page import="javax.xml.namespace.QName" %>
<%@ page import="javax.xml.rpc.Call" %>
<%@ page import="javax.xml.rpc.Service" %>
<%@ page import="javax.xml.rpc.ServiceFactory" %>

<%
String title;
String serviceName;
QName portName;
String targetNs;
String wsdl;
String useJavaServer;
String useMsServer;

String soapServer = 
     request.getParameter("soapServer");
if (soapServer != null && soapServer.equals("java"))
{
   title = "JSP to Servlet Interaction";
   serviceName = "WeatherService";
   portName = new QName("Weather");
   wsdl ="http://localhost:8080/iSoap/javaServer/We
     atherService.wsdl";
   targetNs = "http://localhost:8080/" +
      "iSoap/javaServer/Weather.jws/iSoap/javaSer
     ver/Weather.jws";

   useJavaServer = "checked='checked'";
   useMsServer = "";
}
else
{
   title = "JSP to ASP SOAP Interaction";
   serviceName = "WeatherService";
   portName = new QName("WeatherSoapPort");
   wsdl = "http://localhost/iSoap/msServer/WeatherService.WSDL";
   targetNs = "http://tempuri.org/wsdl/";

   useJavaServer = "";
   useMsServer = "checked='checked'";
}
%>

<%
String where = 
     request.getParameter("city");
String condition = "";
if (where != null)
{
   try
   {
      ServiceFactory sf = 
     ServiceFactory.newInstance();
      Service service = sf.createService(
         new URL(wsdl), new QName(target 
     Ns, serviceName));
      Call getCondition = 
         service.createCall(portName, new QName("getCondition"));

      condition = (String) getCondition.invoke(new Object[] {where});
   }
   catch (Exception e)
   {
      condition += e.getMessage();
   }
}
else
{
   where = "";
}
%>

Additional Code...for This Article