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

passing XML as strings

Expand Messages
  • Ray Rizzuto
    Hi! I want to have a function called GetMetaData, which will return the meta data for a database in XML format. I don t have the XML format fully worked out,
    Message 1 of 4 , Mar 7, 2001
    • 0 Attachment
      Hi!

      I want to have a function called GetMetaData, which will return the
      meta data for a database in XML format. I don't have the XML format
      fully worked out, but it would be similar to the below:

      <TABLE>
      <FIELD>
      <NAME>
      State
      </NAME>
      <TYPE>
      <ENUMERATION>
      <VALUES>
      <VALUE>
      open
      </VALUE>
      <VALUE>
      pending
      </VALUE>
      </VALUES>
      </ENUMERATION>
      </TYPE>
      <ATTRIBUTE WRITABLE=NO />
      </FIELD>
      </TABLE>

      Do I need to do anything special to pass this, or is it transparently
      taken care of by SOAP Lite?

      Ray
    • Paul Kulchenko
      Hi, Ray! It depends on HOW do you want to pass it. 1. You may pass it as encoded string: my $xml = ..... ; and it ll be encoded on wire
      Message 2 of 4 , Mar 7, 2001
      • 0 Attachment
        Hi, Ray!

        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.

        --- Ray Rizzuto <ray.rizzuto@...> wrote:
        > Hi!
        >
        > I want to have a function called GetMetaData, which will return the
        >
        > meta data for a database in XML format. I don't have the XML
        > format
        > fully worked out, but it would be similar to the below:
        >
        > <TABLE>
        > <FIELD>
        > <NAME>
        > State
        > </NAME>
        > <TYPE>
        > <ENUMERATION>
        > <VALUES>
        > <VALUE>
        > open
        > </VALUE>
        > <VALUE>
        > pending
        > </VALUE>
        > </VALUES>
        > </ENUMERATION>
        > </TYPE>
        > <ATTRIBUTE WRITABLE=NO />
        > </FIELD>
        > </TABLE>
        >
        > Do I need to do anything special to pass this, or is it
        > transparently
        > taken care of by SOAP Lite?
        >
        > Ray
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > 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!?
        Get email at your own domain with Yahoo! Mail.
        http://personal.mail.yahoo.com/
      • allierogers@yahoo.com
        Ray and Paul, I also point out that CDATA is a good way to pass valid XML with in XML/XML-RPC/SOAP. ...
        Message 3 of 4 , Mar 21, 2001
        • 0 Attachment
          Ray and Paul,

          I also point out that CDATA is a good way to pass "valid" XML with in
          XML/XML-RPC/SOAP.

          ...
          <SOAP::MyMethodResponse>
          <result type="xsi:string">
          <![CDATA[
          <?xml version="1.0"?>
          <some><valid><xml /></valid></some>
          ]]>
          </result>
          </SOAP::MyMethodResponse>
          ...

          We find this superior to en/decoding the "<" and "&" because its
          easier to view "on the wire" and so makes debugging easier (it's all
          about driving down software cost and driving up reliability). But
          both methods are "correct".

          Allie

          --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
          > Hi, Ray!
          >
          > 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.
          >
          > --- Ray Rizzuto <ray.rizzuto@u...> wrote:
          > > Hi!
          > >
          > > I want to have a function called GetMetaData, which will return
          the
          > >
          > > meta data for a database in XML format. I don't have the XML
          > > format
          > > fully worked out, but it would be similar to the below:
          > >
          > > <TABLE>
          > > <FIELD>
          > > <NAME>
          > > State
          > > </NAME>
          > > <TYPE>
          > > <ENUMERATION>
          > > <VALUES>
          > > <VALUE>
          > > open
          > > </VALUE>
          > > <VALUE>
          > > pending
          > > </VALUE>
          > > </VALUES>
          > > </ENUMERATION>
          > > </TYPE>
          > > <ATTRIBUTE WRITABLE=NO />
          > > </FIELD>
          > > </TABLE>
          > >
          > > Do I need to do anything special to pass this, or is it
          > > transparently
          > > taken care of by SOAP Lite?
          > >
          > > Ray
          > >
          > >
          > > ------------------------ Yahoo! Groups Sponsor
          > >
          > > To unsubscribe from this group, send an email to:
          > > soaplite-unsubscribe@y...
          > >
          > >
          > >
          > > Your use of Yahoo! Groups is subject to
          > > http://docs.yahoo.com/info/terms/
          > >
          > >
          >
          >
          > __________________________________________________
          > Do You Yahoo!?
          > Get email at your own domain with Yahoo! Mail.
          > http://personal.mail.yahoo.com/
        • Paul Kulchenko
          Hi, Allie! True. The only disadv., that XML spec is unclear how to put in CDATA section XML that has CDATA section inside, and though XML messages with CDATA
          Message 4 of 4 , Mar 21, 2001
          • 0 Attachment
            Hi, Allie!

            True. The only disadv., that XML spec is unclear how to put in CDATA
            section XML that has CDATA section inside, and though XML messages
            with CDATA will be parsed fine, only way to create it with SOAP::Lite
            is to do it manually. I don't see the reason to provide separate type
            for that (though it might be the good idea), especially considering
            that it'll be possible soon to wrap it in MIME message, so your
            fragment will be kept separately. Yet it'll make your message bigger.

            best wishes, Paul.

            --- allierogers@... wrote:
            > Ray and Paul,
            >
            > I also point out that CDATA is a good way to pass "valid" XML with
            > in
            > XML/XML-RPC/SOAP.
            >
            > ...
            > <SOAP::MyMethodResponse>
            > <result type="xsi:string">
            > <![CDATA[
            > <?xml version="1.0"?>
            > <some><valid><xml /></valid></some>
            > ]]>
            > </result>
            > </SOAP::MyMethodResponse>
            > ...
            >
            > We find this superior to en/decoding the "<" and "&" because its
            > easier to view "on the wire" and so makes debugging easier (it's
            > all
            > about driving down software cost and driving up reliability). But
            > both methods are "correct".
            >
            > Allie
            >
            > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
            > > Hi, Ray!
            > >
            > > 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.
            > >
            > > --- Ray Rizzuto <ray.rizzuto@u...> wrote:
            > > > Hi!
            > > >
            > > > I want to have a function called GetMetaData, which will return
            >
            > the
            > > >
            > > > meta data for a database in XML format. I don't have the XML
            > > > format
            > > > fully worked out, but it would be similar to the below:
            > > >
            > > > <TABLE>
            > > > <FIELD>
            > > > <NAME>
            > > > State
            > > > </NAME>
            > > > <TYPE>
            > > > <ENUMERATION>
            > > > <VALUES>
            > > > <VALUE>
            > > > open
            > > > </VALUE>
            > > > <VALUE>
            > > > pending
            > > > </VALUE>
            > > > </VALUES>
            > > > </ENUMERATION>
            > > > </TYPE>
            > > > <ATTRIBUTE WRITABLE=NO />
            > > > </FIELD>
            > > > </TABLE>
            > > >
            > > > Do I need to do anything special to pass this, or is it
            > > > transparently
            > > > taken care of by SOAP Lite?
            > > >
            > > > Ray
            > > >
            > > >
            > > > ------------------------ Yahoo! Groups Sponsor
            > > >
            > > > To unsubscribe from this group, send an email to:
            > > > soaplite-unsubscribe@y...
            > > >
            > > >
            > > >
            > > > Your use of Yahoo! Groups is subject to
            > > > http://docs.yahoo.com/info/terms/
            > > >
            > > >
            > >
            > >
            > > __________________________________________________
            > > Do You Yahoo!?
            > > Get email at your own domain with Yahoo! Mail.
            > > http://personal.mail.yahoo.com/
            >
            >
            > ------------------------ Yahoo! Groups Sponsor
            >
            > 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!?
            Get email at your own domain with Yahoo! Mail.
            http://personal.mail.yahoo.com/
          Your message has been successfully submitted and would be delivered to recipients shortly.