You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mark Timmings <ma...@mtbsoftware.co.uk> on 2003/01/09 17:27:51 UTC

Invoking SOAP method using WSDL

Am I missing something obvious with Axis ?

After a little help, I have been able to call BabelFish using it's WSDL file
(see code below):

QName servQN = new QName("http://www.xmethods.net/sd/BabelFishService.wsdl",
"BabelFishService");
QName portQN = new QName("BabelFishPort");
java.net.URL URL = new
java.net.URL("http://www.xmethods.net/sd/2001/BabelFishService.wsdl");
Service  service = new Service(URL, servQN);
Call call = (Call) service.createCall(portQN, "BabelFish");
String msg = (String) call.invoke(new Object[]{new String("en_fr"), new
String("Hello")});

However, this code (which is very similar to the sample code for one of the
GetQuote classes) seems to require me to know more about what's in the WSDL
file as accessing the web service using hand coded values as per the
following:

Service  service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new
java.net.URL("http://services.xmethods.net:80/perl/soaplite.cgi"));
call.setOperationName(new QName("urn:xmethodsBabelFish", "BabelFish"));
String msg = (String) call.invoke(new Object[]{new String("en_fr"), new
String("Hello")});

Is this really how Axis works with WSDL files or have I missed something in
the API ? As I would have assumed that if I gave the URL to the WSDL file,
that I'd have had less information to obtain, maybe just needing to know the
method name and parameters.

Many thanks for any info. on this

All the best
Mark


Re: Invoking SOAP method using WSDL

Posted by Davanum Srinivas <di...@yahoo.com>.
Mark,

Look at the samples.client.DynamicInvoker sample (1.1beta), You can run it using the following
command line:

java samples.client.DynamicInvoker http://www.xmethods.net/sd/BabelFishService.wsdl BabelFish
en_fr hello

Thanks,
dims

--- Mark Timmings <ma...@mtbsoftware.co.uk> wrote:
> Am I missing something obvious with Axis ?
> 
> After a little help, I have been able to call BabelFish using it's WSDL file
> (see code below):
> 
> QName servQN = new QName("http://www.xmethods.net/sd/BabelFishService.wsdl",
> "BabelFishService");
> QName portQN = new QName("BabelFishPort");
> java.net.URL URL = new
> java.net.URL("http://www.xmethods.net/sd/2001/BabelFishService.wsdl");
> Service  service = new Service(URL, servQN);
> Call call = (Call) service.createCall(portQN, "BabelFish");
> String msg = (String) call.invoke(new Object[]{new String("en_fr"), new
> String("Hello")});
> 
> However, this code (which is very similar to the sample code for one of the
> GetQuote classes) seems to require me to know more about what's in the WSDL
> file as accessing the web service using hand coded values as per the
> following:
> 
> Service  service = new Service();
> Call call = (Call) service.createCall();
> call.setTargetEndpointAddress(new
> java.net.URL("http://services.xmethods.net:80/perl/soaplite.cgi"));
> call.setOperationName(new QName("urn:xmethodsBabelFish", "BabelFish"));
> String msg = (String) call.invoke(new Object[]{new String("en_fr"), new
> String("Hello")});
> 
> Is this really how Axis works with WSDL files or have I missed something in
> the API ? As I would have assumed that if I gave the URL to the WSDL file,
> that I'd have had less information to obtain, maybe just needing to know the
> method name and parameters.
> 
> Many thanks for any info. on this
> 
> All the best
> Mark
> 


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

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com