in reply to SOAP - Returning response from Server to Client request based on the <Action>
Global symbol "$input" requires explicit package name at /tmp/soap.pl +line 28. Global symbol "$response" requires explicit package name at /tmp/soap. +pl line 52. Missing right curly or square bracket at /tmp/soap.pl line 53, at end +of line syntax error at /tmp/soap.pl line 53, at EOF /tmp/soap.pl had compilation errors.
You have a few problems with the server side of the code. The first big one, that won't show up even from 'use strict' -- you're printing. That's bad when you're doing SOAP, unless you make sure that they're valid headers. (and even then, I don't recommend it).
Anyway, to answer your initial question -- as SOAP::Lite does RPC/encoded, you need to hand off to a specific function that acts as a switchboard, that can look at the value of the field in question, and then passes off to your other functions. You're also using SOAP::Transport::HTTP::CGI when you seem to be using mod_perl, based on the '<s-gensym15/>' that was returned, and the URL that you used in the client.
Try something more like the following for the server:
#!/usr/local/bin/perl -- use strict; use warnings; use SOAP::Transport::HTTP; SOAP::Transport::HTTP::Apache -> dispatch_to('Delivery') -> handle; package Delivery; use Data::Dumper; sub byName { my ($self, @data) = @_; warn 'Delivery::byName : ',Dumper( @data ); if ($data[0]->{'Action'} eq 'New Ticket') { return sendAcknowledgement(); } else { return { error => 'Unknown Action' }; } } sub sendAcknowledgement { return SOAP::Data->name( Acknowledgement => { createStatus => "OK", Received => "0", } ); }
It uses 'warn', not 'print', so the debugging info is sent to the webserver's error logs. Note that I've also used 'eq' not '==' for the string comparison. What you got returned was an empty hash, because $response wasn't defined. (which is why use strict is your friend) Also, in the client code, you're using a custom serializer, but you've never defined $serializer.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: SOAP - Returning response from Server to Client request based on the <Action>
by chanakya (Friar) on Apr 06, 2005 at 10:30 UTC | |
by jhourcle (Prior) on Apr 06, 2005 at 11:23 UTC | |
by gellyfish (Monsignor) on Apr 06, 2005 at 11:37 UTC |