Return-Path: Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 8674 invoked by uid 500); 12 Jun 2003 15:24:57 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 8601 invoked from network); 12 Jun 2003 15:24:56 -0000 Subject: Re: Follow-up on invoking web service To: axis-user@ws.apache.org X-Mailer: Lotus Notes Release 5.0.11 July 24, 2002 Message-ID: From: michael_sobczak@nutechs.com Date: Thu, 12 Jun 2003 11:24:05 -0400 X-MIMETrack: Serialize by Router on NuTechsHQ02/NuTechs(Release 6.0.1CF1 | March 06, 2003) at 06/12/2003 11:23:55 AM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 , 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 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 + "'"); } }