in reply to SOAP - Returning response from Server to Client request based on the <Action>

This is one of those times when use strict; is in order:
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
    jhorcule, first of all thanks for insisting on "use strict" pragma. In every program, I make it a point to use "strict" and "warning" pragmas, Here I left it go somehow.

    The modified "byName sub" in your server code, gave what I was looking for.
    "Warn" also helped me to check the structure of the document passed to the server.

    Regarding the custom serializer,I've implemented the serializer and deserializer on both client/server ends which looks as below:

      From the looks of things, you're serializing in the document/literal style, as opposed to RPC/encoded. The only thing that I can think of is that you might get some oddities from multiple references to the same object. (but you'd know the data you're sending out better than others, and you may not ever pass that sort of thing)

      As for the XML Schema 2001, I think all that you need to do is to inherit from SOAP::XMLSchema2001::Serializer rather than SOAP::Serializer in your serializer. (but I've never tried doing that).

      The differing namespaces determine the SOAP version, the '1999' versions specify SOAP 1.1, you can set the version to 1.2 using the soapversion() method of SOAP::Lite

      /J\