axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michael_sobc...@nutechs.com
Subject Re: Follow-up on invoking web service
Date Thu, 12 Jun 2003 15:24:05 GMT




Hi Davanum,

Thank you for the code.  It worked great!

I'd like to understand some of the changes you provided.  First off

1) I needed to use call.setOperationUse("literal") because the
GetWeatherText operation defined the soap body with <soap:body
use="literal"/>, right?

2) How would I have known that I should have used
call.setOperationStyle("wrapped")?  Is this specified in the wsdl?

3) why was the parameter added to the call object using addParameter(QName
paramName, QName xmlType, ParameterMode parameterMode) instead of
addParameter(java.lang.String paramName, QName xmlType, ParameterMode
parameterMode)


Thanks,

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


                                                                                         
                                              
                      Davanum Srinivas                                                   
                                              
                      <dims@yahoo.com>         To:       axis-user@ws.apache.org   
                                                    
                                               cc:                                       
                                              
                      06/12/2003 10:25         Subject:  Re: Follow-up on invoking web service
                                         
                      AM                                                                 
                                              
                      Please respond to                                                  
                                              
                      axis-user                                                          
                                              
                                                                                         
                                              
                                                                                         
                                              




Try attached file.

-- dims

--- michael_sobczak@nutechs.com wrote:
>
>
>
>
> 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
>

=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
import org.apache.axis.client.Service;
import org.apache.axis.client.Call;

import javax.xml.namespace.QName;

public class Main {
    public static void main(String[] args) throws Exception {
        String endpoint = "
http://weather.unisysfsp.com/PDCWebService/WeatherServices.asmx?wsdl";
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setOperationStyle(org.apache.axis.enum.Style.WRAPPED);
        call.setOperationUse(org.apache.axis.enum.Use.LITERAL);
        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName(new QName("http://www.unisys.com/WebServices/
","GetWeatherText"));
        call.setProperty(Call.SOAPACTION_URI_PROPERTY, "
http://www.unisys.com/WebServices/GetWeatherText");
        call.addParameter(new javax.xml.namespace.QName("
http://www.unisys.com/WebServices/", "ZipCode"),
org.apache.axis.Constants.XSD_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 + "'");
    }
}




Mime
View raw message