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

Soap and Arrays

Expand Messages
  • timothy_adamec
    Hello! I m currently working on a subscription system with a vendor and they have decided to use .Net for their SOAP back ends. My company, on the other hand,
    Message 1 of 2 , May 13, 2002
    • 0 Attachment
      Hello!

      I'm currently working on a subscription system with a vendor and they
      have decided to use .Net for their SOAP back ends. My company, on the
      other hand, is using Perl on FreeBSD for the majority of our work.

      We've had the usual run-ins when attempting to use .Net with
      SOAP::Lite and we've been able to get data to return from the functions.

      The problem comes in when we call a function that returns an array.
      Here's what we're getting back (I've abbreviated it to two elements;
      we're getting some 5000 lines right now):

      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body>
      <GetTransactionsResponse xmlns="http://www.billpages.com/">
      <GetTransactionsResult>
      <transaction_list xmlns="">
      <transaction_result>
      <id>DCF4C9D8-1EF5-4744-835D-A71A4B8AD8F3</id>

      <subscription_id>C7B90B11-9951-4A5B-96A9-F5AC573E83A4</subscription_id>
      <merchant_id>9DE697D6-E84C-4493-84CE-A473CE91CC47</merchant_id>
      <merchant>Some Merchant</merchant>
      <website>some-website.com</website>
      <billing_option>7 Day Membership</billing_option>
      <buyer>Jones, John</buyer>
      <payment_method>Credit Card</payment_method>
      <amount>6.95</amount>
      <date>2002-05-08T20:59:37</date>
      <type>Trial Purchase</type>
      <status>REJECTED</status>
      <processor_code>FAKE_REJECT</processor_code>
      </transaction_result>
      <transaction_result>
      <id>3980CD51-7808-49E2-A70D-5E8AE93B43CE</id>

      <subscription_id>73EE148F-0A40-4EC1-A9EA-268185AF1CDA</subscription_id>
      <merchant_id>9DE697D6-E84C-4493-84CE-A473CE91CC47</merchant_id>
      <merchant>Some Other Merchant</merchant>
      <website>some-other-website.com</website>
      <billing_option>1 Month Membership</billing_option>
      <buyer>Jones, John</buyer>
      <payment_method>Credit Card</payment_method>
      <amount>29.95</amount>
      <date>2002-05-10T01:57:44</date>
      <type>Trial Purchase</type>
      <status>REJECTED</status>
      <processor_code>REJECT</processor_code>
      </transaction_result>
      </transaction_list>
      </GetTransactionsResult>
      </GetTransactionsResponse>
      </soap:Body>
      </soap:Envelope>

      Looks good, the data is actually in the SOAP::Lite object; I verified
      this by using Data::Dumper and perusing the resulting data structure.
      However, no matter how many results are returnned, all we get back is
      the very last one.

      We're using code similar to the following to get the data:

      my $som = $self->{'SOAP'}->call(SOAP::Data->name($method)->attr({xmlns
      => "$uri/"}) => @_);

      This also works; Data::Dumper on $som takes forever but does, indeed,
      show that the data is there.

      How do I get the individual transactions out of $som?

      Calling $som->result() in either array or scalar context returns the
      last <transaction_result> and calling $som->paramsall() or
      $som->paramsout() yields undef.

      What am I doing wrong?
    • Duncan Cameron
      ... Not looking at the SOAP::Lite list archive, where this is a FAQ! Something like this will help, but _do_ look at the archive, do a search on array or
      Message 2 of 2 , May 14, 2002
      • 0 Attachment
        On 2002-05-13 timothy_adamec wrote:
        >Hello!
        >
        >I'm currently working on a subscription system with a vendor and they
        >have decided to use .Net for their SOAP back ends. My company, on the
        >other hand, is using Perl on FreeBSD for the majority of our work.
        >
        >We've had the usual run-ins when attempting to use .Net with
        >SOAP::Lite and we've been able to get data to return from the functions.
        >
        >The problem comes in when we call a function that returns an array.
        >Here's what we're getting back (I've abbreviated it to two elements;
        >we're getting some 5000 lines right now):
        >
        > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        >xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        > <soap:Body>
        > <GetTransactionsResponse xmlns="http://www.billpages.com/">
        > <GetTransactionsResult>
        > <transaction_list xmlns="">
        > <transaction_result>
        > <id>DCF4C9D8-1EF5-4744-835D-A71A4B8AD8F3</id>
        >
        ><subscription_id>C7B90B11-9951-4A5B-96A9-F5AC573E83A4</subscription_id>
        > <merchant_id>9DE697D6-E84C-4493-84CE-A473CE91CC47</merchant_id>
        > <merchant>Some Merchant</merchant>
        > <website>some-website.com</website>
        > <billing_option>7 Day Membership</billing_option>
        > <buyer>Jones, John</buyer>
        > <payment_method>Credit Card</payment_method>
        > <amount>6.95</amount>
        > <date>2002-05-08T20:59:37</date>
        > <type>Trial Purchase</type>
        > <status>REJECTED</status>
        > <processor_code>FAKE_REJECT</processor_code>
        > </transaction_result>
        > <transaction_result>
        > <id>3980CD51-7808-49E2-A70D-5E8AE93B43CE</id>
        >
        ><subscription_id>73EE148F-0A40-4EC1-A9EA-268185AF1CDA</subscription_id>
        > <merchant_id>9DE697D6-E84C-4493-84CE-A473CE91CC47</merchant_id>
        > <merchant>Some Other Merchant</merchant>
        > <website>some-other-website.com</website>
        > <billing_option>1 Month Membership</billing_option>
        > <buyer>Jones, John</buyer>
        > <payment_method>Credit Card</payment_method>
        > <amount>29.95</amount>
        > <date>2002-05-10T01:57:44</date>
        > <type>Trial Purchase</type>
        > <status>REJECTED</status>
        > <processor_code>REJECT</processor_code>
        > </transaction_result>
        > </transaction_list>
        > </GetTransactionsResult>
        > </GetTransactionsResponse>
        > </soap:Body>
        > </soap:Envelope>
        >
        >Looks good, the data is actually in the SOAP::Lite object; I verified
        >this by using Data::Dumper and perusing the resulting data structure.
        >However, no matter how many results are returnned, all we get back is
        >the very last one.
        >
        >We're using code similar to the following to get the data:
        >
        >my $som = $self->{'SOAP'}->call(SOAP::Data->name($method)->attr({xmlns
        >=> "$uri/"}) => @_);
        >
        >This also works; Data::Dumper on $som takes forever but does, indeed,
        >show that the data is there.
        >
        >How do I get the individual transactions out of $som?
        >
        >Calling $som->result() in either array or scalar context returns the
        >last <transaction_result> and calling $som->paramsall() or
        >$som->paramsout() yields undef.
        >
        >What am I doing wrong?
        >
        Not looking at the SOAP::Lite list archive, where this is a FAQ!

        Something like this will help, but _do_ look at the archive, do a search on 'array' or
        'duplicate' and you'll find plenty of explanantion:

        for my $t ($som->valueof('//transaction_result') {
        print $t->{subscription_id};
        }

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