Hi,

First of all, thanks to Vlad Umansky for helping me get to the point where
I can invoke the Unisys Weather web service.  My code now successfully
invokes the web service and gets a response.  Unfortunately, no matter what
zip code value I supply as the input parameter, I always get back the same
response, which is the weather for Kennett Square, PA.  I've e-mailed with
the owner of the web service, and he told me that Kennett Square is the
default zip code used by the web service when the input parameter provided
to it is invalid.  I've looked at the WSDL for the web service, but didn't
notice anything that signified that the input parameter should be anything
other than a string.  I've defined the input parm as XSD_STRING and
SOAP_STRING, with no change in results.  I've attached the URL for the web
service and my Java code below.  Could someone take a look for me and let
me know what I'm doing wrong?  As before, all help is appreciated.

http://weather.unisysfsp.com/PDCWebService/WeatherServices.asmx?WSDL

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

import javax.xml.namespace.QName;

public class TestClient2
{
   public static void main(String [] args) {
       try {

           // the service location
           String endpoint = 
"http://weather.unisysfsp.com/PDCWebService/WeatherServices.asmx?wsdl";;

           Service  service = new Service();
           Call     call    = (Call) service.createCall();

           call.setTargetEndpointAddress( new java.net.URL(endpoint) );

           // the operation
           call.setOperationName(new QName ( "GetWeatherText" ) );

           // the SOAPAction
           call.setProperty(Call.SOAPACTION_URI_PROPERTY, 
"http://www.unisys.com/WebServices/GetWeatherText"; );

           //call.addParameter ( "ZipCode", org.apache.axis.Constants.XSD_STRING, 
javax.xml.rpc.ParameterMode.IN );
           call.addParameter ( "ZipCode", org.apache.axis.Constants.SOAP_STRING, 
javax.xml.rpc.ParameterMode.IN );

           call.setReturnType ( org.apache.axis.Constants.XSD_STRING );

           String ret = (String) call.invoke ( new Object[] { args[0] } );

           System.out.println("Sent: '" + args[0] + "', got: '" + ret + "'");

       } catch (Exception e) {
           System.err.println(e.toString());
       }
   }
}


Thanks,

Michael Sobczak
NuTechs, Inc.
6785 Telegraph Road, Suite 350
Bloomfield Hills, MI 48301
pager: (248) 316-6524

Reply via email to