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

suppress type info

Expand Messages
  • Srinivas Vippagunta
    Hello, Is there an easy way to suppress the type info in a request? For eg: my $method = SOAP::Data- name( TestMethod ) - attr({xmlns = http://abc.com/ });
    Message 1 of 5 , Apr 2, 2009
    • 0 Attachment
      Hello,
      Is there an easy way to suppress the type info in a request? For eg:

      my $method = SOAP::Data->name('TestMethod')
      ->attr({xmlns => 'http://abc.com/'});

      @params = ( SOAP::Data->name("param1" => 'abc'),
      SOAP::Data->name("myquery" => \SOAP::Data->value(

      SOAP::Data->name("Parameter" =>'')
      ->attr({
      'key1' =>'abc1',

      'Value1' =>'1234'
      }
      )
      ->attr({xmlns => 'http://abcd.com/xyz'});
      my $som1 = $s->call($method => @params);

      the above call generates an soap request with types in it and I am
      getting an error because of that. My request looks like as shown below.
      How can I suppress the xsi:type info. Should I override the Serializer?
      Is this the only way.

      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <soap:Body>
      <TestMethod xmlns="http://abc.com/">
      <param1 xsi:type="xsd:string">abc</param1>
      <myquery xmlns="http://abc.com/xyz">
      <Parameter Value="1234" xsi:type="xsd:string"
      KeyId="abc1"/>
      </query>
      </TestMethod>
      </soap:Body>
      </soap:Envelope>

      thanks,
      Srinivas.
    • Petar Shangov
      You can always create the xml you need using whatever tool you wish and them pass it in raw format to SOAP::Data. From the docs: $xml_content =
      Message 2 of 5 , Apr 2, 2009
      • 0 Attachment
        You can always create the xml you need using whatever tool you wish and them pass it in raw format to SOAP::Data.

        From the docs:

        $xml_content = "<foo><bar>123</bar></foo>";
        $elem = SOAP::Data->type('xml' => $xml_content);


        ----- Original Message ----
        > From: Srinivas Vippagunta <sriniv@...>
        > To: soaplite@yahoogroups.com
        > Sent: Thursday, 2 April, 2009 23:52:34
        > Subject: [soaplite] suppress type info
        >
        > Hello,
        > Is there an easy way to suppress the type info in a request? For eg:
        >
        > my $method = SOAP::Data->name('TestMethod')
        > ->attr({xmlns => 'http://abc.com/'});
        >
        > @params = ( SOAP::Data->name("param1" => 'abc'),
        > SOAP::Data->name("myquery" => \SOAP::Data->value(
        >
        > SOAP::Data->name("Parameter" =>'')
        > ->attr({
        > 'key1' =>'abc1',
        >
        > 'Value1' =>'1234'
        > }
        > )
        > ->attr({xmlns => 'http://abcd.com/xyz'});
        > my $som1 = $s->call($method => @params);
        >
        > the above call generates an soap request with types in it and I am
        > getting an error because of that. My request looks like as shown below.
        > How can I suppress the xsi:type info. Should I override the Serializer?
        > Is this the only way.
        >
        >
        >
        > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        >
        >
        > abc
        >
        >
        > KeyId="abc1"/>
        >
        >
        >
        >
        >
        > thanks,
        > Srinivas.
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
      • Srinivas Vippagunta
        Thanks peter. I tried that and it works but I was somehow hesitant in using the raw xml. I figured out a way to suppress the type info. I created a custom
        Message 3 of 5 , Apr 2, 2009
        • 0 Attachment
          Thanks peter. I tried that and it works but I was somehow hesitant in using
          the raw xml. I figured out a way to suppress the type info. I created a
          custom serializer and in it I "overwrote" the typelookup method.

          sub typelookup() {
          return undef;
          }

          This worked like a charm, but I am not aware of any other side-effects it
          may have.

          I have also tried setting autotype() to false but it didn't work.

          Thanks,
          Srinivas.

          On 4/2/09 2:33 PM, "Petar Shangov" <pshangov@...> wrote:

          >
          > You can always create the xml you need using whatever tool you wish and them
          > pass it in raw format to SOAP::Data.
          >
          > From the docs:
          >
          > $xml_content = "<foo><bar>123</bar></foo>";
          > $elem = SOAP::Data->type('xml' => $xml_content);
          >
          >
          > ----- Original Message ----
          >> From: Srinivas Vippagunta <sriniv@...>
          >> To: soaplite@yahoogroups.com
          >> Sent: Thursday, 2 April, 2009 23:52:34
          >> Subject: [soaplite] suppress type info
          >>
          >> Hello,
          >> Is there an easy way to suppress the type info in a request? For eg:
          >>
          >> my $method = SOAP::Data->name('TestMethod')
          >> ->attr({xmlns => 'http://abc.com/'});
          >>
          >> @params = ( SOAP::Data->name("param1" => 'abc'),
          >> SOAP::Data->name("myquery" => \SOAP::Data->value(
          >>
          >> SOAP::Data->name("Parameter" =>'')
          >> ->attr({
          >> 'key1' =>'abc1',
          >>
          >> 'Value1' =>'1234'
          >> }
          >> )
          >> ->attr({xmlns => 'http://abcd.com/xyz'});
          >> my $som1 = $s->call($method => @params);
          >>
          >> the above call generates an soap request with types in it and I am
          >> getting an error because of that. My request looks like as shown below.
          >> How can I suppress the xsi:type info. Should I override the Serializer?
          >> Is this the only way.
          >>
          >>
          >>
          >> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
          >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          >> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
          >> soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          >>
          >>
          >> abc
          >>
          >>
          >> KeyId="abc1"/>
          >>
          >>
          >>
          >>
          >>
          >> thanks,
          >> Srinivas.
          >>
          >>
          >>
          >>
          >> ------------------------------------
          >>
          >> Yahoo! Groups Links
          >>
          >>
          >>
        • Lee Carmichael
          Hello, Maybe I m missing something more here but when I want to make sure SOAP::Lite doesn t do its automatic typing of an data element I just use the type
          Message 4 of 5 , Apr 6, 2009
          • 0 Attachment
            Hello,

            Maybe I'm missing something more here but when I want to make sure SOAP::Lite doesn't do its automatic typing of an data element I just use the 'type' method and set it to empty string.

            example:  SOAP::Data->name( 'StartDate' => $start )->type('')

            This removes any autotyping.

            In your code below I think this would work:

               SOAP::Data-> name("Parameter" =>'')->attr({ 'key1' =>'abc1', 'Value1' =>'1234' })->attr({xmlns => 'http://abcd. com/xyz'})->type('');

            Not sure but you might be able to add it to the attr method too something like:

               SOAP::Data-> name("Parameter" =>'')->attr({ 'key1' =>'abc1', 'Value1' =>'1234', type => '' })

            But I haven't tested that... it makes me wonder though :)

            Take care,

            Lee




            From: Srinivas Vippagunta <sriniv@...>
            To: Petar Shangov <pshangov@...>; soaplite@yahoogroups.com
            Sent: Thursday, April 2, 2009 4:39:45 PM
            Subject: Re: [soaplite] suppress type info

            Thanks peter. I tried that and it works but I was somehow hesitant in using
            the raw xml. I figured out a way to suppress the type info. I created a
            custom serializer and in it I "overwrote" the typelookup method.

            sub typelookup() {
            return undef;
            }

            This worked like a charm, but I am not aware of any other side-effects it
            may have.

            I have also tried setting autotype() to false but it didn't work.

            Thanks,
            Srinivas.

            On 4/2/09 2:33 PM, "Petar Shangov" <pshangov@yahoo. com> wrote:

            >
            > You can always create the xml you need using whatever tool you wish and them
            > pass it in raw format to SOAP::Data.
            >
            > From the docs:
            >
            > $xml_content = "<foo><bar>123< /bar></foo> ";
            > $elem = SOAP::Data-> type('xml' => $xml_content) ;
            >
            >
            > ----- Original Message ----
            >> From: Srinivas Vippagunta <sriniv@yahoo- inc.com>
            >> To: soaplite@yahoogroup s.com
            >> Sent: Thursday, 2 April, 2009 23:52:34
            >> Subject: [soaplite] suppress type info
            >>
            >> Hello,
            >> Is there an easy way to suppress the type info in a request? For eg:
            >>
            >> my $method = SOAP::Data-> name('TestMethod ')
            >> ->attr({xmlns => 'http://abc.com/'});
            >>
            >> @params = ( SOAP::Data-> name("param1" => 'abc'),
            >> SOAP::Data-> name("myquery" => \SOAP::Data- >value(
            >>
            >> SOAP::Data-> name("Parameter" =>'')
            >> ->attr({
            >> 'key1' =>'abc1',
            >>
            >> 'Value1' =>'1234'
            >> }
            >> )
            >> ->attr({xmlns => 'http://abcd. com/xyz'});
            >> my $som1 = $s->call($method => @params);
            >>
            >> the above call generates an soap request with types in it and I am
            >> getting an error because of that. My request looks like as shown below.
            >> How can I suppress the xsi:type info. Should I override the Serializer?
            >> Is this the only way.
            >>
            >>
            >>
            >> xmlns:soapenc= "http://schemas. xmlsoap.org/ soap/encoding/"
            >> xmlns:xsd="http://www.w3. org/2001/ XMLSchema"
            >> xmlns:soap="http://schemas. xmlsoap.org/ soap/envelope/"
            >> soap:encodingStyle= "http://schemas. xmlsoap.org/ soap/encoding/">
            >>
            >>
            >> abc
            >>
            >>
            >> KeyId="abc1" />
            >>
            >>
            >>
            >>
            >>
            >> thanks,
            >> Srinivas.
            >>
            >>
            >>
            >>
            >> ------------ --------- --------- ------
            >>
            >> Yahoo! Groups Links
            >>
            >>
            >>

          • rahed
            ... $s- autotype(0); should be ok for requests from a client. -- Radek
            Message 5 of 5 , Apr 7, 2009
            • 0 Attachment
              "Srinivas Vippagunta" <sriniv@...> writes:

              > Hello,
              > Is there an easy way to suppress the type info in a request? For eg:

              $s->autotype(0);

              should be ok for requests from a client.

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