Re: Soap Server in perl
- From: Ian Wilson <scobloke2@xxxxxxxxxxxxx>
- Date: Mon, 23 Oct 2006 17:24:58 +0100
Kuna wrote:
Ian Wilson wrote:Kuna wrote:Ian Wilson wrote:Kuna wrote:
I want to create a SOAP server in perl so have gone through web
but thatr was not satisfactory. If any body will give sample
codes or some well defined link then that will be helpfull to
me.
http://www.soaplite.com/
The quickstart guide and cookbook have examples.
Hi Ian thanks a lot for replying but this link is not opening and
apart of that I want to say that I have tried many links but
those are having fundamental ideas but I need to reate soap
server in perl which will invoke some methods and show me the
responce from the server. So if possible then suggest me some
sample codes for some advanced operation.
That URL works fine here. If my Internet connection was broken, the
way yours is, I'd phone my ISP and complain!
Sorry Ian I donot mean to say like that but actually I am new to perl
and I have given this task to be done so as per my little knowledge I
am not able to get these examples from the web so I want that some
one will guide me and by which I can able to get some knowledge and
get my to be done. Again sorry if I have asked something worng to
you.
Its not that simple. If you don't have a web-server with support for CGI and Perl in which you can install SOAP::Lite then you'll have to implement the SOAP support some other way. The SOAP::Lite documentation covers various ways.
Here's an example of server code (soaptemp.pl)
#!/usr/bin/perl -w
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('Temperatures')
-> handle;
package Temperatures;
sub f2c {
my ($class, $f) = @_;
return 5/9*($f-32);
}
sub c2f {
my ($class, $c) = @_;
return 32+$c*9/5;
}
Here's the corresponding client code (soaptempclient.pl)
#!/usr/bin/perl -w
use SOAP::Lite;
$c = shift @ARGV;
$c = 37.5 unless $c;
"$c C = ",
SOAP::Lite
-> uri('http://your.server.name/Temperatures')
-> proxy ('https://your.server.name/cgi-bin/soaptemp.pl')
-> c2f($c)
-> result,
" F\n";
Note: this is old code, you should use warnings; use strict; There are lots of different ways of writing soap clients and soap servers using SOAP::Lite. There is a feature that lets you call remote subroutines exactly the way you would if they were local subroutines. There's no substitute for reading the documentation.
If you are new to Perl you may find the examples hard to understand. If this is so then you need to practice Perl on some simpler problems before you move onto SOAP.
I suggest this:
1) Write a simple Perl program with a subroutine,
2) Move the subroutine to a module. Alter the main program to use that module.
3) Move your module unchanged to your web server and write a generic SOAP dispatcher (designated by the proxy in the client) that hands off SOAP requests to modules (designated by the URI provided by the client) There's an example in the docs, it is 4 lines long plus shebang, comments and spacing.
Use autodispach in the client so that your client only needs a couple of lines adding to it.
.
- Follow-Ups:
- Re: Soap Server in perl
- From: Kuna
- Re: Soap Server in perl
- References:
- Soap Server in perl
- From: Kuna
- Re: Soap Server in perl
- From: Ian Wilson
- Re: Soap Server in perl
- From: Kuna
- Re: Soap Server in perl
- From: Ian Wilson
- Re: Soap Server in perl
- From: Kuna
- Soap Server in perl
- Prev by Date: cpu idle measurement: sar/vmstat
- Next by Date: Re: File and directory permissions
- Previous by thread: Re: Soap Server in perl
- Next by thread: Re: Soap Server in perl
- Index(es):
Relevant Pages
|
Loading