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

Re: [soaplite] xml data as parameter

Expand Messages
  • Paul Kulchenko
    Hi, David! ... It s possible (technically), but it ll require writing custom deserializer. In general, easiest way to transfer XML is to pass it as string
    Message 1 of 3 , May 14, 2001
    • 0 Attachment
      Hi, David!

      > what is the easiest way to retrieve the xml data as
      > a string and not as a reference to a hash?
      >
      > is it possible to do this without encoding it?
      It's possible (technically), but it'll require writing custom
      deserializer. In general, easiest way to transfer XML is to pass it
      as string (it'll be encoded on client side and decoded on server), so
      your application will get it as a string.

      Here is an extract from my answer to similar question (mentioned
      module is attached):

      It depends on HOW do you want to pass it.

      1. You may pass it as encoded string:

      my $xml = '<TABLE><FIELD>.....</TABLE>';

      and it'll be encoded on wire ('<', '&', couple of other things) and
      sent as ONE parameter, so other side will get it EXACTLY as specified
      (already decoded) and will need to parse if required.

      <GetMetaDataResponse>
      <result>
      <TABLE><FIELD>....</TABLE>
      </result>
      </GetMetaDataResponse>

      2. You may pass it as xml fragment:

      my $xml = SOAP::Data->type(xml => '<TABLE><FIELD>...</TABLE>');

      And in that case this XML will be inserted AS IS inside envelope and
      DESERIALIZED on other side as usual:

      <GetMetaDataResponse>
      <result>
      <TABLE>
      <FIELD>
      ....
      </TABLE>
      </result>
      </GetMetaDataResponse>

      3. Similar to 2., but serialized from data structure, result is the
      same on other side (but it'll look little bit different on wire,
      because types will be added if autotype is on (default)):

      my $xml = {TABLE => {FIELD => ... }};

      4. You may also consider de/serializing from/to XML::DOM or other
      representations, next version will include examples for custom
      de/serialization. On wire it'll look like 2 and 3 and just give you
      convenience of providing XML::DOM::Document or other variable without
      going into details about it, but you'll need to override serializer
      and provide this capabilities (this module should be included with
      next version).

      So, choice is yours. Hope it helps.

      Best wishes, Paul.

      --- david milby <davidm@...> wrote:
      > i am trying to pass xml data as a parameter.
      >
      > what is the easiest way to retrieve the xml data as
      > a string and not as a reference to a hash?
      >
      > is it possible to do this without encoding it?
      >
      > --david
      >
      >
      >
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      > ---------------------~-~>
      > Become a member FREE at http://www.searchdatabase.com?Offer=yahoo5
      > today.
      > Save time finding the best Database Development and
      > Management information available on the Internet.
      > Our targeted search engine and dedicated editorial staff "cut out
      > the clutter" by aggregating the best links and the most relevant
      > database news for you
      > every day.
      > http://us.click.yahoo.com/_w3RtC/rGiCAA/bT0EAA/WNqXlB/TM
      >
      ---------------------------------------------------------------------_->
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Yahoo! Auctions - buy the things you want at great prices
      http://auctions.yahoo.com/
    • jbirchfield@ironmax.com
      I have a sopa service(written in Java) deployed using the Apache SOAP library. My service excepts an object of type Element. How can I pass the appropriate
      Message 2 of 3 , May 31, 2001
      • 0 Attachment
        I have a sopa service(written in Java) deployed using the Apache SOAP
        library. My service excepts an object of type Element. How can I
        pass the appropriate type to it? Following is my code:

        #!perl -w
        #!d:\perl\bin\perl.exe

        # -- SOAP::Lite -- soaplite.com -- Copyright (C) 2001 Paul Kulchenko -
        -

        use SOAP::Lite;
        use XML::DOM;

        my $dom = new XML::DOM::Parser;
        my $doc = $dom->parsefile($ARGV[0]);

        print $doc->toString;

        my $r = SOAP::Lite
        -> uri('urn:LatLong')
        -> proxy('http://10.10.10.210/soap/servlet/rpcrouter');
        ###These are the things that are getting me. Nothing seems to work
        right...
        my $xml = $doc->toString;
        my $element = SOAP::Data->type(xml => ref $doc);
        my $a = $r->getLatLong($element);

        unless ($a->fault) {
        print SOAP::Deserializer->as_xml($a->result);
        }
        else {
        print "Fault:\n";
        print join ', ',
        $a->faultcode,
        $a->faultstring,
        $a->faultdetail;
        }
      Your message has been successfully submitted and would be delivered to recipients shortly.