Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

calling methods from external web service

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)});
 
Ranch Hand
Posts: 1067
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Could yuo tell me where on the axis site the examples are
Look here
 
William Barnes
Ranch Hand
Posts: 1067
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
There's a hole in the bucket, dear Liza, dear Liza, a hole in the bucket, dear liza, a tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic