• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling methods from external web service

 
dale con
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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

Many Thanks
 
dale con
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Could yuo tell me where on the axis site the examples are
Look here
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic