I've got a Java web app that needs to call a web service that sits on a different server.
Here's the code for the perl script I have that calls the service:
#!/usr/bin/perl -w
use SOAP::Lite;
my $user = 'user';
my $password = 'password';
my $loginURI = "http://someserver:8080/SakaiLogin.jws?wsdl";
my $scriptURI = "http://someserver:8080/sakai-axis/scripts/RosterService.jws?wsdl";
my $loginsoap = SOAP::Lite
-> proxy($loginURI)
-> uri($loginURI);
my $scriptsoap = SOAP::Lite
-> proxy($scriptURI)
-> uri($scriptURI);
my $session = $loginsoap->login($user, $password)->result;
# doSiteRoster(session, site_id, user_id)
my $result = $scriptsoap->doSiteRoster($session, "cfc338aa-acfb-41a6-a998-7e467afc297b", "djswartz")->result;
my $logout = $loginsoap->logout($session)->result;
exit;
Now, I'm thinking I can use javax.xml.ws.Service...Although I'm not quite sure how to go about it. Any direction would be awesome.
I would use either :
Or
You can find the simple examples http://code.google.com/p/simple-samples/source/checkout and documentation about them in http://code.google.com/p/simple-samples/downloads/list
This is a very open ended question. -There are quite a few frameworks/libraries in java to invoke webservices.
Check these frameworks out wsif, axis,jax-ws and choose what you like. While the first one is specifically for invocation, the last two are more full fledged and helps you created server side (your own services) as well as client side code.