Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Service enabling PERL and accessing it from a non-PERL client

Status
Not open for further replies.

ragus22

Programmer
May 29, 2008
1
0
0
US
Hi,
I am basically new to wbeservices using PERL. I have a perl script
that I need to service enable and this service nneeds to be called by
a non-PERL client.
Can someone please walk me through the steps. This is what I have
done so far.
1) Created a class called Demo(.pm) with two methods hello and bye.
---- Demo.pm ----
#! C:\Perl\bin\perl
package Demo;

sub hello {
shift;
$name = shift;
return "Hello there, $name";
}

sub bye {
shift;
$name = shift;
return "Goodbye, $name";
}

sub languages {
return ("Perl", "C", "sh");
}
1;
----

2) Created a SOAP server called TestDemo.cgi
**** TestDemo.cgi ****
#! C:\Perl\bin\perl

use SOAP::Transport::HTTP;
use Demo;

SOAP::Transport::HTTP::CGI
-> dispatch_to('Demo')
-> handle;

****
3) When I call this server using a PerlClient it works fine and
returns the "Hello <NAME>" statement.
******TestDemo.pl*****
#!C:\Perl\bin

use SOAP::Lite;

# Instantiate a new SOAP::Lite object
my $service = new SOAP::Lite
->uri('->proxy('
# Remotely call the getTemp method
$name = shift;

my $result = $service->hello(SOAP::Data->type(string => $name));

unless ($result->fault) {
print $result->result();
} else {
print join ', ',
$result->faultcode,
$result->faultstring,
$result->faultdetail;
}
*********
>TestDemo.pl Joe
>Hello there, Joe
**
4) How to I call this service from a non-PERL(say Java) client.
 
Hi,
I think this post is more suitable on Java forum rather than Perl one to get a better answer.

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Web services are supposed to be agnostic. You shouldn't need to know what language is used by the service provider in order to call it.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top