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

Re: [soaplite] Re: String conversion

Expand Messages
  • 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 1 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.