in reply to SOAP::Lite server - returning non-SOAP values in sub

If you know how to distinguish between "soap" and ordinary function, then
sub mysub { my $result; fill the code to get $result ok if ($soap) # $soap is true if this function is called from a webser +vice { $result=SOAP::Data...($result)....; } return $result; }
Maybe I lost something in your question..

Replies are listed 'Best First'.
Re^2: SOAP::Lite server - returning non-SOAP values in sub
by DreamT (Pilgrim) on Aug 25, 2011 at 15:33 UTC
    Hi, What I want is that the caller to wrap the return values in soap tags, so that i don't have to add logic in the subs themselves. In this way I can call existing subs without altering them. Of course I need some way to "name" the return values, but I thought that this maybe is possible?

    I guess I could wrap the subs up manually, using a "mysub_soap", whose only mission is to call mysub, wrap the return from mysub in tags, and return it.
      Its called a subclass, also, a serializer

      one way with Autoloading

      ->dispatch_to('MyModule::SOAPIFY'); ... package MyModule::SOAPIFY; @ISA = qw[ MyModule ]; sub thisMethodNeedsSpecificWrapping { ... } sub AUTOLOAD { ... GenericWrapper... }