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

String conversion

Expand Messages
  • sid69se <sid69se@yahoo.se>
    Hi, I will serialize a string 123 but Soap::Lite converts it to an int. Is there a way to force a string. regs Sid
    Message 1 of 3 , Dec 17, 2002
    • 0 Attachment
      Hi,
      I will serialize a string "123" but Soap::Lite converts it to an int.
      Is there a way to force a string.

      regs
      Sid
    • sid69se <sid69se@yahoo.se>
      Hi, I will include a little more info. SOAP::Data- type( string )- name(var = 123) of course forces type string on the 123. But I need to send a composite
      Message 2 of 3 , Dec 18, 2002
      • 0 Attachment
        Hi, I will include a little more info.

        SOAP::Data->type('string')->name(var => 123) of course forces type
        string on the 123.

        But I need to send a composite data type.

        my $comp = bless{
        SOAP::Data->name(a => 'abc'),
        SOAP::Data->type('string')->name(var => 323),
        SOAP::Data->name(answerText => ["blah blah - 1",
        "blah blah - 2"])
        }=> 'mytype';

        my @request = {
        SOAP::Data->name(a => 'a'),
        SOAP::Data->name(b => 'b'),
        SOAP::Data->name(c => 'c'),
        $comp
        };

        I get strange results with this, the xml has data missing and I get
        the error "Odd number of elements in hash assignment".

        Help !!!!!!!!!!!!!!!!

        /regs
        Sid
      • Duncan Cameron
        ... You have only 3 values in your hash assignment for mytype , you haven t any keys for the hash, so you need something like: my $comp = bless{ a =
        Message 3 of 3 , Dec 18, 2002
        • 0 Attachment
          On 2002-12-18 sid69se <sid69se wrote:
          >Hi, I will include a little more info.
          >
          >SOAP::Data->type('string')->name(var => 123) of course forces type
          >string on the 123.
          >
          >But I need to send a composite data type.
          >
          >my $comp = bless{
          > SOAP::Data->name(a => 'abc'),
          > SOAP::Data->type('string')->name(var => 323),
          > SOAP::Data->name(answerText => ["blah blah - 1",
          > "blah blah - 2"])
          >}=> 'mytype';
          >
          >my @request = {
          > SOAP::Data->name(a => 'a'),
          > SOAP::Data->name(b => 'b'),
          > SOAP::Data->name(c => 'c'),
          > $comp
          >};
          >
          >I get strange results with this, the xml has data missing and I get
          >the error "Odd number of elements in hash assignment".
          >
          You have only 3 values in your hash assignment for 'mytype', you
          haven't any keys for the hash, so you need something like:

          my $comp = bless{
          a => SOAP::Data->value('abc'),
          var => SOAP::Data->type('string', 323),
          answerText => SOAP::Data->value([
          "blah blah - 1",
          "blah blah - 2"
          ])
          }=> 'mytype';

          Although a SOAP::Data variable with only a value() doesn't really do
          anything.
          Also you want () not {} for your @request array.

          Regards,
          Duncan Cameron
        Your message has been successfully submitted and would be delivered to recipients shortly.