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.


In reply to Re: SOAP - Returning response from Server to Client request based on the <Action> by jhourcle
in thread SOAP - Returning response from Server to Client request based on the <Action> by chanakya

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.