R
Rickard Sjostrom
Hi!
I have set up a SOAP server in Ruby. Implementing a client in Ruby is no
problems. But I want a Perl client to be able to access the provided
services but I failed...
This is how I did, it is really simple code:
Ruby SOAP server: (seems to be ok)
------------------------------------------
require 'server_dispatcher'
require 'soap/rpc/standaloneServer'
class DeliveryService < SOAP::RPC::StandaloneServer
#will be run when an instance of this class is created
def on_init
srvdisp = ServerDispatcher.new
add_method(srvdisp, "find")
end
end
class ServerDispatcher
def find
puts "Running find()"
return "DUMMYTEXT";
end
end
server = DeliveryService.new("Demo",
"http://rickthemick.com/DeliveryService", "0.0.0.0", 9090)
server.start
--------------------------------------------
Perl Client:
--------------------------------------------
#!/usr/bin/perl
use strict;
use SOAP::Lite;
my $server = "http://myserver.com:9090"; #routable
my $ns = "http://rickthemick.com:9090/DeliveryService"; #just a
namespace/fake
print "Client started...\n";
my $service = SOAP::Lite
-> uri($ns)
-> proxy($server);
my $result = $service -> find() -> result();
if (not defined $result){
print "No result recevied...\n";
}else {
print "length: ".scalar($result)."\n";
print "result: $result\n";
}
exit;
--------------------------------------------
And this happends when running the client:
---------------------------------------------
(89)# soap/:./client.pl
Client started...
No result recevied...
(90)# soap/:
---------------------------------------------
In the server window nothing seems to happen. When I use my ruby code as
client it prints "Running find()" and I get text "DUMMYTEXT" back, so I
know it works.
If I change the port to e.g myserver.com:2222 I get a "connection
refused" error!
Any I ideas, all help is very much appreciated!
Regards
/Rickard
I have set up a SOAP server in Ruby. Implementing a client in Ruby is no
problems. But I want a Perl client to be able to access the provided
services but I failed...
This is how I did, it is really simple code:
Ruby SOAP server: (seems to be ok)
------------------------------------------
require 'server_dispatcher'
require 'soap/rpc/standaloneServer'
class DeliveryService < SOAP::RPC::StandaloneServer
#will be run when an instance of this class is created
def on_init
srvdisp = ServerDispatcher.new
add_method(srvdisp, "find")
end
end
class ServerDispatcher
def find
puts "Running find()"
return "DUMMYTEXT";
end
end
server = DeliveryService.new("Demo",
"http://rickthemick.com/DeliveryService", "0.0.0.0", 9090)
server.start
--------------------------------------------
Perl Client:
--------------------------------------------
#!/usr/bin/perl
use strict;
use SOAP::Lite;
my $server = "http://myserver.com:9090"; #routable
my $ns = "http://rickthemick.com:9090/DeliveryService"; #just a
namespace/fake
print "Client started...\n";
my $service = SOAP::Lite
-> uri($ns)
-> proxy($server);
my $result = $service -> find() -> result();
if (not defined $result){
print "No result recevied...\n";
}else {
print "length: ".scalar($result)."\n";
print "result: $result\n";
}
exit;
--------------------------------------------
And this happends when running the client:
---------------------------------------------
(89)# soap/:./client.pl
Client started...
No result recevied...
(90)# soap/:
---------------------------------------------
In the server window nothing seems to happen. When I use my ruby code as
client it prints "Running find()" and I get text "DUMMYTEXT" back, so I
know it works.
If I change the port to e.g myserver.com:2222 I get a "connection
refused" error!
Any I ideas, all help is very much appreciated!
Regards
/Rickard