import java.net.*;
import java.util.*;
import org.apache.soap.rpc.Call;
import org.apache.soap.rpc.Response;
import org.apache.soap.rpc.Parameter; 
import org.apache.soap.SOAPException;
import org.apache.soap.Constants;


public class WeatherClient
{
	public static void main(String args[])
	{
		Call call = new Call();
		call.setTargetObjectURI("urn:SpheonJSOAPChemistry");
		call.setMethodName("getNameBySymbol");
		call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
		Vector argumentToMethod = new Vector();
		argumentToMethod.addElement(new Parameter("zip", String.class, "Au", null));
		call.setParams(argumentToMethod);
		
		URL url = null;
		
		try
		{
			url = new URL("http://213.23.125.181:8080/RPC");
		}
		catch(MalformedURLException mux)
		{
			System.err.println(mux);
		}
		
		Response res = null;
		
		try
		{
			res = call.invoke(url,"");
		}
		catch(SOAPException se)
		{
			System.err.println("Caught SOAPException (" + se.getFaultCode() + "): " + se.getMessage()); 
		}
		
		if (!res.generatedFault())
		{
			Parameter ret = res.getReturnValue(); 
            Object value = ret.getValue();
			System.out.println("Response returned is: " + value);
		}
		else
		{
			System.out.println("Fault " + res.getFault() + " generated in Response");
		}
		
		
	}
}
