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

RE: [soaplite] get a Value from the ResponseEnvelope

Expand Messages
  • Clain, Dominique
    Thanks. 1. Can i specify, like you say, an attribute just for -ONE- SOAP Response Element, even if they are several calls in my perl script..or the add of the
    Message 1 of 6 , Feb 26, 2001
      RE: [soaplite] get a Value from the ResponseEnvelope

      Thanks.
      1. Can i specify, like you say, an attribute just for -ONE- SOAP Response Element, even if they are several calls in my perl script..or the add of the attribute is applicated at all the Response Envelope?

      In fact, i would like add an attribute just for the call which returns a Map..
      2. Is it normal, when we use a Map (De)Serializer, we have a XML struct we can't use if we looking for a element thanks to its key or value?

      Thanks again..

      Dominique CLAIN
      Lumos Technologies Inc.
      dclain@...
      (310) 453-5832


      -----Original Message-----
      From: Paul Kulchenko [mailto:paulclinger@...]
      Sent: Monday, February 26, 2001 11:31 AM
      To: soaplite@yahoogroups.com; Clain, Dominique
      Subject: Re: [soaplite] get a Value from the ResponseEnvelope


      Hi, Clain!

      > if ($vm->match('//item/key'))
      > {
      >   print "\value:"; print $vm->valueof('user.region');

      >  }
      you need to use just $vm->valueof;
      valueof() returns value of last match without parameters and MAKEs
      match and then returns the result if provided parameter:

      $vm->match('//item/key');
      $vm->valueof;

      -- is the same as --

      $vm->match('//item/key')->valueof;

      -- which is the same as --

      $vm->valueof('//item/key');

      except that ->match() will also return true/false in boolean context,
      so you can check for match and valueof() will return undef if not
      found, but there could also be undef as the VALUE of the matched
      element.

      > Is it possible to get the value of a Attribute (from a Hashtable)
      > from the Response Envelope..?
      As for ATTRIBUTES, you may use dataof() instead of valueof() in the
      same context and dataof() will return SOAP::Data object, so you can
      access ALL information about element that is available in XML
      encoding. For example:

      $vm->dataof('//item/key')->attr->{'some_attribute'};

      will access some_attribute on key element if any

      <item>
        <key xsi:type="xsd:string" some_attribute="value">user.region</key>
        <value xsi:type="xsd:string">US</value>
      </item>

      Hope it helps.

      Best wishes, Paul.

      --- "Clain, Dominique" <Dominique.Clain@...> wrote:
      > Hi ,
      > Is it possible to get the value of a Attribute (from a Hashtable)
      > from the Response Envelope..?
      >
      > Here is my Response Envelope obtained thanks to SOAP::Trace
      >
      > <SOAP-ENV:Envelope xmlns:SOAP-ENV="
      > http://schemas.xmlsoap.org/soap/envelope/
      > <http://schemas.xmlsoap.org/soap/envelope/> " xmlns:xsi="
      > http://www.w3.org/1999/XMLSchema-instance
      > <http://www.w3.org/1999/XMLSchema-instance> " xmlns:xsd="
      > http://www.w3.org/1999/XMLSchema <http://www.w3.org/1999/XMLSchema>
      > ">
      >    <SOAP-ENV:Body>
      >     <ns1:getVMPropertiesSoapResponse
      > xmlns:ns1="lumos:lclient:ServerManager" SOAP-
      > ENV:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/
      > <http://schemas.xmlsoap.org/soap/encoding/> ">
      >  <return xmlns:ns2="lumos.lclient.ServerManager"
      > xsi:type="ns2:Map">
      >  <item>
      >   <key xsi:type="xsd:string">user.region</key>
      >   <value xsi:type="xsd:string">US</value>
      >   </item>
      >
      > And i would like obtain directly in my perl script, for example,
      > the value of the key "user.region", i try this, but i've bot
      > "nothing".
      >
      > if ($vm->match('//item/key'))
      > {
      >   print "\value:"; print $vm->valueof('user.region');

      >  }
      >  else
      >  {
      >         print"\n nothing";
      >  }
      >
      > Anybody can help me..
      > Thanks...
      >
      > Dominique CLAIN
      > Lumos Technologies Inc.
      > dclain@...
      > (310) 453-5832
      >
      >
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Get email at your own domain with Yahoo! Mail.
      http://personal.mail.yahoo.com/

    • Paul Kulchenko
      Hi, Clain! I m not sure I understood you right, but you can always return element with attribute, providing SOAP::Data object instead of plain element, return
      Message 2 of 6 , Feb 26, 2001
        Hi, Clain!

        I'm not sure I understood you right, but you can always return
        element with attribute, providing SOAP::Data object instead of plain
        element,

        return SOAP::Data->name('a' => 25)->attr({attribute => 'value'});

        instead of

        return 25;

        or even

        return {a => SOAP::Data->name(name => 'value')};

        In general SOAP::Data object can be anywhere where you have a value
        (but NOT as hash's key).

        As for second question, I don't quite understand it. Could you
        probably rephrase it?

        Best wishes, Paul.

        --- "Clain, Dominique" <Dominique.Clain@...> wrote:
        > Thanks.
        > 1. Can i specify, like you say, an attribute just for -ONE- SOAP
        > Response Element, even if they are several calls in my perl
        > script..or
        > the add of the attribute is applicated at all the Response
        > Envelope?
        > In fact, i would like add an attribute just for the call which
        > returns a
        > Map..
        > 2. Is it normal, when we use a Map (De)Serializer, we have a XML
        > struct
        > we can't use if we looking for a element thanks to its key or
        > value?
        >
        > Thanks again..
        >
        > Dominique CLAIN
        > Lumos Technologies Inc.
        > dclain@...
        > (310) 453-5832
        >
        >
        > -----Original Message-----
        > From: Paul Kulchenko [mailto:paulclinger@...]
        > Sent: Monday, February 26, 2001 11:31 AM
        > To: soaplite@yahoogroups.com; Clain, Dominique
        > Subject: Re: [soaplite] get a Value from the ResponseEnvelope
        >
        >
        > Hi, Clain!
        >
        > > if ($vm->match('//item/key'))
        > > {
        > > print "\value:"; print $vm->valueof('user.region');
        > >
        > > }
        > you need to use just $vm->valueof;
        > valueof() returns value of last match without parameters and MAKEs
        > match and then returns the result if provided parameter:
        >
        > $vm->match('//item/key');
        > $vm->valueof;
        >
        > -- is the same as --
        >
        > $vm->match('//item/key')->valueof;
        >
        > -- which is the same as --
        >
        > $vm->valueof('//item/key');
        >
        > except that ->match() will also return true/false in boolean
        > context,
        > so you can check for match and valueof() will return undef if not
        > found, but there could also be undef as the VALUE of the matched
        > element.
        >
        > > Is it possible to get the value of a Attribute (from a Hashtable)
        > > from the Response Envelope..?
        > As for ATTRIBUTES, you may use dataof() instead of valueof() in the
        > same context and dataof() will return SOAP::Data object, so you can
        > access ALL information about element that is available in XML
        > encoding. For example:
        >
        > $vm->dataof('//item/key')->attr->{'some_attribute'};
        >
        > will access some_attribute on key element if any
        >
        > <item>
        > <key xsi:type="xsd:string"
        > some_attribute="value">user.region</key>
        > <value xsi:type="xsd:string">US</value>
        > </item>
        >
        > Hope it helps.
        >
        > Best wishes, Paul.
        >
        > --- "Clain, Dominique" <Dominique.Clain@...> wrote:
        > > Hi ,
        > > Is it possible to get the value of a Attribute (from a Hashtable)
        > > from the Response Envelope..?
        > >
        > > Here is my Response Envelope obtained thanks to SOAP::Trace
        > >
        > > <SOAP-ENV:Envelope xmlns:SOAP-ENV="
        > > http://schemas.xmlsoap.org/soap/envelope/
        > > <http://schemas.xmlsoap.org/soap/envelope/> " xmlns:xsi="
        > > http://www.w3.org/1999/XMLSchema-instance
        > > <http://www.w3.org/1999/XMLSchema-instance> " xmlns:xsd="
        > > http://www.w3.org/1999/XMLSchema
        > <http://www.w3.org/1999/XMLSchema>
        > > ">
        > > <SOAP-ENV:Body>
        > > <ns1:getVMPropertiesSoapResponse
        > > xmlns:ns1="lumos:lclient:ServerManager" SOAP-
        > > ENV:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/
        > > <http://schemas.xmlsoap.org/soap/encoding/> ">
        > > <return xmlns:ns2="lumos.lclient.ServerManager"
        > > xsi:type="ns2:Map">
        > > <item>
        > > <key xsi:type="xsd:string">user.region</key>
        > > <value xsi:type="xsd:string">US</value>
        > > </item>
        > >
        > > And i would like obtain directly in my perl script, for example,
        > > the value of the key "user.region", i try this, but i've bot
        > > "nothing".
        > >
        > > if ($vm->match('//item/key'))
        > > {
        > > print "\value:"; print $vm->valueof('user.region');
        > >
        > > }
        > > else
        > > {
        > > print"\n nothing";
        > > }
        > >
        > > Anybody can help me..
        > > Thanks...
        > >
        > > Dominique CLAIN
        > > Lumos Technologies Inc.
        > > dclain@...
        > > (310) 453-5832
        > >
        > >
        > >
        > >
        >
        >
        > __________________________________________________
        > Do You Yahoo!?
        > Get email at your own domain with Yahoo! Mail.
        > http://personal.mail.yahoo.com/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Get email at your own domain with Yahoo! Mail.
        http://personal.mail.yahoo.com/
      • Clain, Dominique
        Hi paul, my second question is: I use a Map (De)Serializer in order to get my Map Object received from a SOAP Call, like you use a BeanSerializer for a simple
        Message 3 of 6 , Feb 26, 2001
          RE: [soaplite] get a Value from the ResponseEnvelope

          Hi paul,
          my second question is:

          I use a Map (De)Serializer in order to get my Map Object received from a SOAP Call, like you use a BeanSerializer for a simple object..and i would like to get a value according its key.

          But this (De)Serializer create/use a XML struct like this:
          <item>
          <key>...</key>
          <value>...</value>
          </item>

          Actually, I mean we can't use this XML struct, because we can't find a value according to its key ...
          So we must modify the XML Struct, maybe like you say :
          <item>
            <key xsi:type="xsd:string" some_attribute="value">user.region</key>
             <value xsi:type="xsd:string">US</value>
          </item>

          And so, how can I make it?

          Thanks a lot.

          Dominique CLAIN
          Lumos Technologies Inc.
          dclain@...
          (310) 453-5832


          -----Original Message-----
          From: Paul Kulchenko [mailto:paulclinger@...]
          Sent: Monday, February 26, 2001 1:58 PM
          To: soaplite@yahoogroups.com
          Subject: RE: [soaplite] get a Value from the ResponseEnvelope


          Hi, Clain!

          I'm not sure I understood you right, but you can always return
          element with attribute, providing SOAP::Data object instead of plain
          element,

          return SOAP::Data->name('a' => 25)->attr({attribute => 'value'});

          instead of

          return 25;

          or even

          return {a => SOAP::Data->name(name => 'value')};

          In general SOAP::Data object can be anywhere where you have a value
          (but NOT as hash's key).

          As for second question, I don't quite understand it. Could you
          probably rephrase it?

          Best wishes, Paul.

          --- "Clain, Dominique" <Dominique.Clain@...> wrote:
          > Thanks.
          > 1. Can i specify, like you say, an attribute just for -ONE- SOAP
          > Response Element, even if they are several calls in my perl
          > script..or
          > the add of the attribute is applicated at all the Response
          > Envelope?
          > In fact, i would like add an attribute just for the call which
          > returns a
          > Map..
          > 2. Is it normal, when we use a Map (De)Serializer, we have a XML
          > struct
          > we can't use if we looking for a element thanks to its key or
          > value?
          >
          > Thanks again..
          >
          > Dominique CLAIN
          > Lumos Technologies Inc.
          > dclain@...
          > (310) 453-5832
          >
          >
          > -----Original Message-----
          > From: Paul Kulchenko [mailto:paulclinger@...]
          > Sent: Monday, February 26, 2001 11:31 AM
          > To: soaplite@yahoogroups.com; Clain, Dominique
          > Subject: Re: [soaplite] get a Value from the ResponseEnvelope
          >
          >
          > Hi, Clain!
          >
          > > if ($vm->match('//item/key'))
          > > {
          > >   print "\value:"; print $vm->valueof('user.region');
          > > 
          > >  }
          > you need to use just $vm->valueof;
          > valueof() returns value of last match without parameters and MAKEs
          > match and then returns the result if provided parameter:
          >
          > $vm->match('//item/key');
          > $vm->valueof;
          >
          > -- is the same as --
          >
          > $vm->match('//item/key')->valueof;
          >
          > -- which is the same as --
          >
          > $vm->valueof('//item/key');
          >
          > except that ->match() will also return true/false in boolean
          > context,
          > so you can check for match and valueof() will return undef if not
          > found, but there could also be undef as the VALUE of the matched
          > element.
          >
          > > Is it possible to get the value of a Attribute (from a Hashtable)
          > > from the Response Envelope..?
          > As for ATTRIBUTES, you may use dataof() instead of valueof() in the
          > same context and dataof() will return SOAP::Data object, so you can
          > access ALL information about element that is available in XML
          > encoding. For example:
          >
          > $vm->dataof('//item/key')->attr->{'some_attribute'};
          >
          > will access some_attribute on key element if any
          >
          > <item>
          >   <key xsi:type="xsd:string"
          > some_attribute="value">user.region</key>
          >   <value xsi:type="xsd:string">US</value>
          > </item>
          >
          > Hope it helps.
          >
          > Best wishes, Paul.
          >
          > --- "Clain, Dominique" <Dominique.Clain@...> wrote:
          > > Hi ,
          > > Is it possible to get the value of a Attribute (from a Hashtable)
          > > from the Response Envelope..?
          > >
          > > Here is my Response Envelope obtained thanks to SOAP::Trace
          > >
          > > <SOAP-ENV:Envelope xmlns:SOAP-ENV="
          > > http://schemas.xmlsoap.org/soap/envelope/
          > > <http://schemas.xmlsoap.org/soap/envelope/> " xmlns:xsi="
          > > http://www.w3.org/1999/XMLSchema-instance
          > > <http://www.w3.org/1999/XMLSchema-instance> " xmlns:xsd="
          > > http://www.w3.org/1999/XMLSchema
          > <http://www.w3.org/1999/XMLSchema>
          > > ">
          > >    <SOAP-ENV:Body>
          > >     <ns1:getVMPropertiesSoapResponse
          > > xmlns:ns1="lumos:lclient:ServerManager" SOAP-
          > > ENV:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/
          > > <http://schemas.xmlsoap.org/soap/encoding/> ">
          > >  <return xmlns:ns2="lumos.lclient.ServerManager"
          > > xsi:type="ns2:Map">
          > >  <item>
          > >   <key xsi:type="xsd:string">user.region</key>
          > >   <value xsi:type="xsd:string">US</value>
          > >   </item>
          > >
          > > And i would like obtain directly in my perl script, for example,
          > > the value of the key "user.region", i try this, but i've bot
          > > "nothing".
          > >
          > > if ($vm->match('//item/key'))
          > > {
          > >   print "\value:"; print $vm->valueof('user.region');
          > > 
          > >  }
          > >  else
          > >  {
          > >         print"\n nothing";
          > >  }
          > >
          > > Anybody can help me..
          > > Thanks...
          > >
          > > Dominique CLAIN
          > > Lumos Technologies Inc.
          > > dclain@...
          > > (310) 453-5832
          > >
          > >
          > >
          > >
          >
          >
          > __________________________________________________
          > Do You Yahoo!?
          > Get email at your own domain with Yahoo! Mail.
          > http://personal.mail.yahoo.com/
          >
          >


          __________________________________________________
          Do You Yahoo!?
          Get email at your own domain with Yahoo! Mail.
          http://personal.mail.yahoo.com/

          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/


        • Paul Kulchenko
          Hi, Clain! ... Actually you shouldn t worry about underlying structure, because deserializer will make from Map elements proper hash, so you ll just need to
          Message 4 of 6 , Feb 26, 2001
            Hi, Clain!

            > I use a Map (De)Serializer in order to get my Map Object received
            > from a
            > SOAP Call, like you use a BeanSerializer for a simple object..and i
            > would like to get a value according its key.
            Actually you shouldn't worry about underlying structure, because
            deserializer will make from Map elements proper hash, so you'll just
            need to use it.

            $hash = $soap->getVMPropertiesSoap(...)->result;

            should give you HASH referense, and later you can use

            $hash->{key}

            to get your value. That's it. No worries about XML payload unless you
            want to do something REALLY specific and even in that case SOAP::Lite
            has enough high-level methods to do it (hopefully).

            Best wishes, Paul.

            --- "Clain, Dominique" <Dominique.Clain@...> wrote:
            > Hi paul,
            > my second question is:
            >
            > I use a Map (De)Serializer in order to get my Map Object received
            > from a
            > SOAP Call, like you use a BeanSerializer for a simple object..and i
            > would like to get a value according its key.
            >
            > But this (De)Serializer create/use a XML struct like this:
            > <item>
            > <key>...</key>
            > <value>...</value>
            > </item>
            >
            > Actually, I mean we can't use this XML struct, because we can't
            > find a
            > value according to its key ...
            > So we must modify the XML Struct, maybe like you say :
            > <item>
            > <key xsi:type="xsd:string"
            > some_attribute="value">user.region</key>
            > <value xsi:type="xsd:string">US</value>
            > </item>
            >
            > And so, how can I make it?
            >
            > Thanks a lot.
            >
            > Dominique CLAIN
            > Lumos Technologies Inc.
            > dclain@...
            > (310) 453-5832
            >
            >
            > -----Original Message-----
            > From: Paul Kulchenko [mailto:paulclinger@...]
            > Sent: Monday, February 26, 2001 1:58 PM
            > To: soaplite@yahoogroups.com
            > Subject: RE: [soaplite] get a Value from the ResponseEnvelope
            >
            >
            > Hi, Clain!
            >
            > I'm not sure I understood you right, but you can always return
            > element with attribute, providing SOAP::Data object instead of
            > plain
            > element,
            >
            > return SOAP::Data->name('a' => 25)->attr({attribute => 'value'});
            >
            > instead of
            >
            > return 25;
            >
            > or even
            >
            > return {a => SOAP::Data->name(name => 'value')};
            >
            > In general SOAP::Data object can be anywhere where you have a value
            > (but NOT as hash's key).
            >
            > As for second question, I don't quite understand it. Could you
            > probably rephrase it?
            >
            > Best wishes, Paul.
            >
            > --- "Clain, Dominique" <Dominique.Clain@...> wrote:
            > > Thanks.
            > > 1. Can i specify, like you say, an attribute just for -ONE- SOAP
            > > Response Element, even if they are several calls in my perl
            > > script..or
            > > the add of the attribute is applicated at all the Response
            > > Envelope?
            > > In fact, i would like add an attribute just for the call which
            > > returns a
            > > Map..
            > > 2. Is it normal, when we use a Map (De)Serializer, we have a XML
            > > struct
            > > we can't use if we looking for a element thanks to its key or
            > > value?
            > >
            > > Thanks again..
            > >
            > > Dominique CLAIN
            > > Lumos Technologies Inc.
            > > dclain@...
            > > (310) 453-5832
            > >
            > >
            > > -----Original Message-----
            > > From: Paul Kulchenko [mailto:paulclinger@...]
            > > Sent: Monday, February 26, 2001 11:31 AM
            > > To: soaplite@yahoogroups.com; Clain, Dominique
            > > Subject: Re: [soaplite] get a Value from the ResponseEnvelope
            > >
            > >
            > > Hi, Clain!
            > >
            > > > if ($vm->match('//item/key'))
            > > > {
            > > > print "\value:"; print $vm->valueof('user.region');
            > > >
            > > > }
            > > you need to use just $vm->valueof;
            > > valueof() returns value of last match without parameters and
            > MAKEs
            > > match and then returns the result if provided parameter:
            > >
            > > $vm->match('//item/key');
            > > $vm->valueof;
            > >
            > > -- is the same as --
            > >
            > > $vm->match('//item/key')->valueof;
            > >
            > > -- which is the same as --
            > >
            > > $vm->valueof('//item/key');
            > >
            > > except that ->match() will also return true/false in boolean
            > > context,
            > > so you can check for match and valueof() will return undef if not
            > > found, but there could also be undef as the VALUE of the matched
            > > element.
            > >
            > > > Is it possible to get the value of a Attribute (from a
            > Hashtable)
            > > > from the Response Envelope..?
            > > As for ATTRIBUTES, you may use dataof() instead of valueof() in
            > the
            > > same context and dataof() will return SOAP::Data object, so you
            > can
            > > access ALL information about element that is available in XML
            > > encoding. For example:
            > >
            > > $vm->dataof('//item/key')->attr->{'some_attribute'};
            > >
            > > will access some_attribute on key element if any
            > >
            > > <item>
            > > <key xsi:type="xsd:string"
            > > some_attribute="value">user.region</key>
            > > <value xsi:type="xsd:string">US</value>
            > > </item>
            > >
            > > Hope it helps.
            > >
            > > Best wishes, Paul.
            > >
            > > --- "Clain, Dominique" <Dominique.Clain@...> wrote:
            > > > Hi ,
            > > > Is it possible to get the value of a Attribute (from a
            > Hashtable)
            > > > from the Response Envelope..?
            > > >
            > > > Here is my Response Envelope obtained thanks to SOAP::Trace
            > > >
            > > > <SOAP-ENV:Envelope xmlns:SOAP-ENV="
            > > > http://schemas.xmlsoap.org/soap/envelope/
            > > > <http://schemas.xmlsoap.org/soap/envelope/> " xmlns:xsi="
            > > > http://www.w3.org/1999/XMLSchema-instance
            > > > <http://www.w3.org/1999/XMLSchema-instance> " xmlns:xsd="
            > > > http://www.w3.org/1999/XMLSchema
            > > <http://www.w3.org/1999/XMLSchema>
            > > > ">
            > > > <SOAP-ENV:Body>
            > > > <ns1:getVMPropertiesSoapResponse
            > > > xmlns:ns1="lumos:lclient:ServerManager" SOAP-
            > > > ENV:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/
            > > > <http://schemas.xmlsoap.org/soap/encoding/> ">
            > > > <return xmlns:ns2="lumos.lclient.ServerManager"
            > > > xsi:type="ns2:Map">
            > > > <item>
            > > > <key xsi:type="xsd:string">user.region</key>
            > > > <value xsi:type="xsd:string">US</value>
            > > > </item>
            > > >
            > > > And i would like obtain directly in my perl script, for
            > example,
            > > > the value of the key "user.region", i try this, but i've bot
            > > > "nothing".
            > > >
            > > > if ($vm->match('//item/key'))
            > > > {
            > > > print "\value:"; print $vm->valueof('user.region');
            > > >
            > > > }
            > > > else
            > > > {
            > > > print"\n nothing";
            > > > }
            > > >
            > > > Anybody can help me..
            > > > Thanks...
            > > >
            > > > Dominique CLAIN
            > > > Lumos Technologies Inc.
            > > > dclain@...
            > > > (310) 453-5832
            > > >
            > > >
            >
            === message truncated ===


            __________________________________________________
            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.