This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes calling methods from external web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "calling methods from external web service" Watch "calling methods from external web service" New topic
Author

calling methods from external web service

dale con
Ranch Hand

Joined: Apr 15, 2005
Posts: 93
Dear All

Can someplease sjow me hoe to call a method from a wsdl file?

I have a url for a wdsl file exposing it's methods, i want to write a webservice that uses te methods - can someone show me how, or point me to a tutorial

Many Thanks
Jan Vandernoot
Greenhorn

Joined: Mar 05, 2002
Posts: 6
With Apache Axis (http://ws.apache.org/axis/) you can generate Java classes that do the SOAP call for you. You can then just call the methods from the web service using these generated classes. Check out the user's guide on the site for more info and examples!

Regards,
Jan
prem saggar
Ranch Hand

Joined: Aug 24, 2000
Posts: 66
I agree with the above poster. What you'll do is get the WSDL for the webservice you need. Then run WSDL2Java on it. This part is tough and needs practice. You'll have this massive classpath pointing at all the axis files. Anyhow that generates all the client-remote code needed to interface with the webservice. The Axis guide will actually walk you through it. If you need more detail I'm here. Prem.
dale con
Ranch Hand

Joined: Apr 15, 2005
Posts: 93
Hi

Could yuo tell me where on the axis site the examples are

Many Thanks
dale con
Ranch Hand

Joined: Apr 15, 2005
Posts: 93
hi

I am writing a server-side web service that uses an external wsdl file and accessing methods from the external web service.

Once thta's done, i'll create a wsdl file for a client to use

So i'll have to do it like this

But do't kow how to carry on

Many thankd for any help



String endpoint = "http://thirdpartycallservice/third_party_calling_service.wsdl";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(endpoint));

// method to call
call.setOperation("mehodToCall");

// call the service
String a = args[0];
String b = args[1];
String c = args[2];

String result = (String)call.invoke(new Object[] {new String(a), new String(b), new String(c)});
dale con
Ranch Hand

Joined: Apr 15, 2005
Posts: 93
hi

I am writing a server-side web service that uses an external wsdl file and accessing methods from the external web service.

Once thta's done, i'll create a wsdl file for a client to use

So i'll have to do it like this

But do't know how to carry on

Many thanks for any help



String endpoint = "http://thirdpartycallservice/third_party_calling_service.wsdl";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(endpoint));

// method to call
call.setOperation("mehodToCall");

// call the service
String a = args[0];
String b = args[1];
String c = args[2];

String result = (String)call.invoke(new Object[] {new String(a), new String(b), new String(c)});
dale con
Ranch Hand

Joined: Apr 15, 2005
Posts: 93
hi

I am writing a server-side web service that uses an external wsdl file and accessing methods from the external web service.

Once thta's done, i'll create a wsdl file for a client to use

So i'll have to do it like this

But don't know how to carry on

Many thanks for any help



String endpoint = "http://thirdpartycallservice/third_party_calling_service.wsdl";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(endpoint));

// method to call
call.setOperation("methodToCall");

// call the service
String a = args[0];
String b = args[1];
String c = args[2];

String result = (String)call.invoke(new Object[] {new String(a), new String(b), new String(c)});
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

> Could yuo tell me where on the axis site the examples are
Look here


Please ignore post, I have no idea what I am talking about.
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

And I don't think that refering to it as a "external webservice" is the right way of thinking about it.
What you want to write is both a webservice client and server. When you are the client you are just using a webservice server. And when you are the server someone else is the webserver client.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calling methods from external web service
 
Similar Threads
Servlet issue
serializable class
Database access
java: Cannot find symbol
Parsing .java file