Loading ...
Sorry, an error occurred while loading the content.

How to manipulate SOAP::Lite Server answer to special format ?

Expand Messages
  • chfoerst@ymail.com
    Dear group, I asked the same to the perlmonks, but maybe here are more Soaplite specialists :-) So here we go : I got a question about SOAP::Lite, which I
    Message 1 of 2 , Mar 17 2:01 PM
    • 0 Attachment
      Dear group,
      I asked the same to the perlmonks, but maybe here are more Soaplite specialists :-)

      So here we go :

      I got a question about SOAP::Lite, which I can't fiddle out:

      my $daemon = SOAP::Transport::HTTP::Daemon
      -> new (LocalPort => 8088, Reuse => 1)
      -> on_action(sub {})
      -> dispatch_to('ServiceError');
      print "Contact to SOAP server at ", $daemon->url, "\n";
      $daemon->handle;

      sub ServiceError {
      print "ServiceError\n";
      return SOAP::Data->name('ResponseType')->value('ACKNOWLEDGE');
      }


      This returns the following SOAP-XML to the client:

      <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:so +apenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/ +envelope/">
      <soap:Body>
      <ServiceErrorResponse xmlns="http://DataModel_v4.xxxxxxxxx.com">
      <ResponseType xsi:type="xsd:string">ACKNOWLEDGE</ResponseType>
      </ServiceErrorResponse>
      </soap:Body>
      </soap:Envelope>

      but this one I need to send to the client :

      <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:so +apenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/ +envelope/">
      <soapenv:Body>
      <ResponseType>ACKNOWLEDGE</ResponseType>
      </soapenv:Body>
      </soapenv:Envelope>

      Is there a way to tell SOAP::Lite to suppress the <ServiceErrorResponse> Tags around my single-line message?

      Thanks for any hints !

      Cheers,
      Christian
    • Martin Kutter
      Hi, ... you have to tweak the SOAP server to use a freeform response - to do so, subclass the server class you re using and override the handle method.
      Message 2 of 2 , Mar 18 1:59 PM
      • 0 Attachment
        Hi,

        > but this one I need to send to the client :
        >
        > <soap:Envelope
        > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:so
        > +apenc="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > xmlns:soap="http://schemas.xmlsoap.org/soap/ +envelope/">
        > <soapenv:Body>
        > <ResponseType>ACKNOWLEDGE</ResponseType>
        > </soapenv:Body>
        > </soapenv:Envelope>
        >
        > Is there a way to tell SOAP::Lite to suppress the
        > <ServiceErrorResponse> Tags around my single-line message?

        you have to tweak the SOAP server to use a freeform response - to do so,
        subclass the server class you're using and override the handle method.
        SOAP::Server always returns a "response" type message.

        For generating the content itself, see the SOAP::Serializer manpage and
        look for "freeform".

        Martin
      Your message has been successfully submitted and would be delivered to recipients shortly.