Elina Law
2006-Apr-27 07:45 UTC
[Rails] SOAP service - perl server, ruby consumer incompatability
Hi All, Wonder if any of you guys can help troubleshoot the following for me. What I''m trying to achieve is: 1) Perl web service, using SOAP::Lite (server) 2) Ruby web service consumer, using SOAP::RPC::DRIVER (client) My problem is, if my client and server are both Perl based, the output is as expected. However, if the client is Ruby based (haven''t tried another language), it gets an error. I have three files. Two on the server side and one on the client side. *Server Side* First, the script. === cgi script - located in c:/apache/cgi-bin/misc/ OdbcBridgeServer.pl ==#!C:/perl/bin/perl.exe -w use strict; use SOAP::Transport::HTTP; use OdbcBridgeServer; my $name = shift; SOAP::Transport::HTTP::CGI -> dispatch_to(''OdbcBridgeServer'') -> handle; === end cgi script == Secondly, the Perl server side module (this is a cut down version). === module file - located in c:/perl/lib/OdbcBridgeServer.pm ==package OdbcBridgeServer; use DBI; use strict; sub new { my $type = shift(@_); my $class = ref($type) || $type; my $self = { class => $class, sql => shift, @_ }; bless ($self, $class); $self; } sub set_sql() { my $self = shift(@_); my $sql = shift(@_) || "Select * from stock_master"; return "" if !($sql =~ /^select/i); $self->{sql} = $sql; } 1; === end module file == *Client Side* The third file is the client. === client script - on /Users/elinalaw/src/odbcBridgeClient.rb ==require ''soap/rpc/driver'' begin ENDPOINT = ''http://elina/cgi-bin/misc/OdbcBridgeServer.pl'' NAMESPACE = ''http://elina/cgi-bin/misc/OdbcBridgeServer'' ob = SOAP::RPC::Driver.new(ENDPOINT, NAMESPACE) ob.add_rpc_method(''set_sql'', ''a_string'') rescue Exception => ex puts "first block" puts ex end begin ob.call("set_sql", "select * from cre_master") rescue Exception => ex puts "second block" puts ex end === end client script == When I run the programme, the output was: === start output ==RubyMate r2903 running Ruby v1.8.3. >>> ~/src/odbcBridgeClient.rb second block Failed to access class (cgi-bin::misc::OdbcBridgeServer) at C:/Perl/ site/lib/SOAP/Lite.pm line 2131. Program exited normally. === end output == What''s the best way to find out what requests/responses are going between the client and server? Thanks all, E
brabuhr@gmail.com
2006-Apr-27 20:35 UTC
[Rails] SOAP service - perl server, ruby consumer incompatability
> === client script - on /Users/elinalaw/src/odbcBridgeClient.rb ==> require ''soap/rpc/driver'' > > begin > ENDPOINT = ''http://elina/cgi-bin/misc/OdbcBridgeServer.pl'' > NAMESPACE = ''http://elina/cgi-bin/misc/OdbcBridgeServer'' > ob = SOAP::RPC::Driver.new(ENDPOINT, NAMESPACE) > ob.add_rpc_method(''set_sql'', ''a_string'') > rescue Exception => ex > puts "first block" > puts ex > end > . . . > > What''s the best way to find out what requests/responses are going > between the client and server?>From the Ruby end:ob.wiredump_dev = STDERR will dump to standard error; there is probably something similar on the Perl end. Also, a sniffer such as tcpdump or Ethereal can be used; Ethereal''s follow TCP stream feature is quite nice.