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

Re: [soaplite] Digest Number 635

Expand Messages
  • Alberto Accomazzi
    Stefan, apologies... I had misunderstood your question. As far as I can tell there is no easy way to get to the original XML in the body on the server side.
    Message 1 of 1 , Jun 25, 2003
    • 0 Attachment
      Stefan,

      apologies... I had misunderstood your question. As far as I can tell
      there is no easy way to get to the original XML in the body on the
      server side. The best you can do is access the SOAP::SOM object but at
      that point the XML has already been deserialized (and from what I can
      tell there is no way to get to the original XML).

      The best next thing I could come up with was subclassing the
      deserializer on the server side, storing the original SOAP message
      (headers, body and all) in the envelope, and then resending it back to
      the client. One could then pick things apart to get to the original
      payload inside the <Body>. I know this is not what you were after, but
      I thought I'd post it for the benefit of the list.

      -- Alberto



      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('Echo')
      -> deserializer(MyDeserializer->new)
      -> handle;

      BEGIN {
      use SOAP::Lite;
      package Echo;
      use base 'SOAP::Server::Parameters';
      sub echo {
      my $envelope = pop;
      return "this is the SOAP message:\n". $envelope->{_message};
      }

      package MyDeserializer;
      use vars qw(@ISA);
      @ISA = qw(SOAP::Deserializer);
      sub deserialize {
      my $self = shift;
      my $result = $self->SUPER::deserialize(@_);
      $result->{_message} = $_[0];
      return $result;
      }
      }


      > Date: Wed, 25 Jun 2003 09:21:05 -0000
      > From: "stormmaster42" <stefan@...>
      > Subject: Re: Receiving type 'xml' on serverside - preventing deserialization of body.
      >
      > Hi Alberto,
      >
      > thanks for your reply.
      > But maybe I'm getting something completely wrong here.
      > Why would I need a SOAP::Lite object on the server side?
      >
      > And I tried your code like so:
      >
      > ----- SERVER -----
      > my $soap = SOAP::Lite
      > -> uri("urn:IplsRotSoap")
      > -> proxy("myproxy")
      > -> outputxml(1);
      >
      > my $s = SOAP::Transport::HTTP::CGI
      > -> dispatch_to('MyPackage');
      > $s -> handle;
      >
      > package MyPackage;
      > sub echo {
      > my ( $self, $a ) = @_;
      > return $a;
      > }
      > ----
      >
      > But $a still is the deserialzed hash of the xml I threw in the message
      > on the client like:
      > $soapResult = $soap -> echo(SOAP::Data->type('xml')->name(info =>
      > $myxml));
      >
      > What I want is that $a contains exactly the same xml-string as the
      > original $myxml.
      >
      > Cheers,
      > Stefan
      >
      > --- In soaplite@yahoogroups.com, Alberto Accomazzi <aaccomazzi@c...>
      > wrote:
      >
      >>Stefan,
      >>
      >>simply use the outputxml() option when you create your SOAP::Lite
      >
      > object:
      >
      >>my $soap = SOAP::Lite
      >> -> uri('http://simon.fell.com/calc')
      >> -> proxy('http://www.razorsoft.net/ssss4c/soap.asp')
      >> -> outputxml(1);
      >>
      >>
      >>
      >>-- Alberto
      >>
      >>
      >>> Date: Mon, 23 Jun 2003 12:02:49 -0000
      >>> From: "stormmaster42" <stefan@c...>
      >>>Subject: Receiving type 'xml' on serverside - preventing
      >
      > deserialization of body.
      >
      >>>Hi,
      >>>
      >>>I am trying to write a client/service-combination that exchanges a
      >>>SOAP-message containing an XML document.
      >>>
      >>>I know how to put the XML into the message. What I am doing on the
      >>>client is:
      >>>$soapResult = $soap -> verify(SOAP::Data->type('xml')->name(info
      >
      > =>
      >
      >>>$myxml));
      >>>
      >>>Now how do I get the content of the variable $myxml on the server
      >
      > side
      >
      >>>inside my handling subroutine?
      >>>To me it seems that SOAP::Lite is always trying to deserialize the
      >>>body into hashes, which I do not want in this case. Because I
      >
      > would
      >
      >>>like to do some validation/transformation on the transmitted XML.
      >>>
      >>>Unfortunately encoding the XML as a base64 string or escaping
      >
      > special
      >
      >>>characters is not an option since the real client (not SOAP::Lite)
      >
      > is
      >
      >>>not able to do that.
      >>>
      >>>Any help greatly appreciated.
      >>>Thanx,
      >>>Stefan
    Your message has been successfully submitted and would be delivered to recipients shortly.