in reply to Re: SOAP::Lite server - changing method name in response
in thread SOAP::Lite server - changing method name in response

<quote>The code you posted doesn't show any code from the guide, or a client. </quote> - I intentionally left out the guide code since I didn't get it to work, to "start from scratch" so to speak. Regarding the client, I left it out since I didn't think it was needed - I know how the data should look like. But I guess it should've been included for the possibility to recreate the problem.

I tried to add
BEGIN { package MySerializer; @MySerializer::ISA = 'SOAP::Serializer'; sub envelope { $_[2] =~ s/Response$// if $_[1] =~ /^(?:method|response)$/; shift->SUPER::envelope(@_); }

in the end of MyModule, but it doesn't seem to do anything. Maybe because I'm not using the Daemon approach, but rather the "cgi-server" approach?

My client code:
#!/usr/bin/perl use SOAP::Lite +trace => 'debug'; use Data::Dumper; $HOST = "http://path/to/server.pl"; $NS = "urn:MyModule"; $PHRASE = shift; # read from the command line my $soap = SOAP::Lite ->readable(1) ->uri($NS) ->proxy($HOST); my $som = $soap->product_info_request( SOAP::Data->name("version" + => "1.0"), SOAP::Data->name("prod_no" + => "$PHRASE") ); $res = $som->result; print Dumper($som);

Replies are listed 'Best First'.
Re^3: SOAP::Lite server - changing method name in response
by Anonymous Monk on Aug 24, 2011 at 15:26 UTC

    in the end of MyModule, but it doesn't seem to do anything. Maybe because I'm not using the Daemon approach, but rather the "cgi-server" approach? My client code:

    Um, I alrady went through the trouble of posting a complete, runnable, self contained, working example

    Copy and paste all the appropriate bits into your program

      I appreciate your effort.:) I ran it (in two instances of course, one server and one client) and got the following result:<bt>
      <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http:/ +/www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSche +ma-instance"> <soap:Header> <prod_no xsi:type="xsd:string">two</prod_no> </soap:Header> <soap:Body> <product_info_requestResponse xmlns="http://127.0.0.1/MyModule" xs +i:nil="true"/> </soap:Body> </soap:Envelope>

      Also, it may be a problem for me using Proc::Background, since the environment that this is going to be used in is quite hard to install new perl modules. But that's a minor.
        (And now when I understood what you were using Proc::Background for, I don't see it as a problem anymore :-) )
        #~ ->serializer( MySerializer->new ) # WORKS