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

multiple params to stub module

Expand Messages
  • cracknphrack
    Hi Everyone, I built a module with stubmaker.pl to connect to a web service which generated two parameters parameters = [
    Message 1 of 2 , Aug 17 2:34 PM
    • 0 Attachment
      Hi Everyone,
      I built a module with stubmaker.pl to connect to a web service which
      generated two parameters

      <code snippet of the two parameters>
      parameters => [
      SOAP::Data->new(name => 'primaryCard', type => 'tns:Card', attr
      => {}),
      SOAP::Data->new(name => 'receipent', type =>
      'tns:OrderCardReceipent', attr => {}),
      </code snippet of the two parameters>

      (yes, I know, the 'receipent' is spelled wrong, but that's what is in
      their WSDL)

      I called the stub:
      <snip>
      use SecondaryCardOrder qw(:all);
      my $seccardord = new SecondaryCardOrder;
      </snip>

      Here's the XML that I was shown as an example output:
      # <primaryCard>
      # <CardNumber>string</CardNumber>
      # <ExpiredDate>string</ExpiredDate>
      # <CV2>string</CV2>
      # </primaryCard>
      # <receipent>
      # <Receipent>
      # <Param1>string</Param1>
      # <Param2>string</Param2>
      # <Param3>string</Param3>
      # </Receipent>
      # <LoadAmount>decimal</LoadAmount>
      # <Message>string</Message>
      # <OrderFee>
      # <FeeType>string</FeeType>
      # <Fee>decimal</Fee>
      # </OrderFee>
      # </receipent>


      These params are complex types, so I proceeded to build them as a scalar
      I've included an example of how I build "primaryCard", I used similar
      methods
      to build "receipent" and then tested them with Data Dumper just to be
      sure they looked OK.

      <code snippet of building xml>
      my $primaryCard = ( SOAP::Data->name("primaryCard" =>
      \SOAP::Data->value(
      SOAP::Data->name("CardNumber" => '0000111122223333'),
      SOAP::Data->name("ExpiredDate" => '12/09'),
      SOAP::Data->name("CV2" => '111')
      ))
      );
      </code snippet of building xml>

      ...and then call the function

      <snip>
      my $svcresult = $seccardord->OrderSecondaryCard( "primaryCard" =>
      $primaryCard,
      "receipent" =>
      $receipent );
      </snip>


      So...
      when I set debug on SOAP::lite and trace, the resulting XML that gets
      posted
      will only use the second param. only the "receipent" fields get filled in
      and the "primaryCard" is empty. I thought maybe something was wrong
      with how I built the XML, so I swapped the variables

      <snip>
      my $svcresult = $seccardord->OrderSecondaryCard( "primaryCard" =>
      $receipent,
      "receipent" =>
      $primaryCard );
      </snip>


      and the output had the same result. the primaryCard area was empty,
      and the receipent
      area had the primaryCard information filled in just fine. Wierd.

      am I calling the function wrong? should I use arrays instead of
      scalars when calling
      the stub? I'm stuck.
    • Eric Bridger
      It s been a while since I played with stubmaker.pl but if I remember correctly it s abilities are slim. I remember having to modify the generated Perl
      Message 2 of 2 , Aug 20 7:08 PM
      • 0 Attachment
        It''s been a while since I played with stubmaker.pl but if I
        remember correctly it's abilities are slim.
        I remember having to modify the generated Perl module, i.e.
        SecondayCardOrder.pm.
        You need to search for the SecondayCardOrder method you are calling
        and edit it so it knows what the paarmeters actually are.

        HTH.
        Eric

        On Aug 17, 2008, at 5:34 PM, cracknphrack wrote:

        > Hi Everyone,
        > I built a module with stubmaker.pl to connect to a web service which
        > generated two parameters
        >
        > <code snippet of the two parameters>
        > parameters => [
        > SOAP::Data->new(name => 'primaryCard', type => 'tns:Card', attr
        > => {}),
        > SOAP::Data->new(name => 'receipent', type =>
        > 'tns:OrderCardReceipent', attr => {}),
        > </code snippet of the two parameters>
        >
        > (yes, I know, the 'receipent' is spelled wrong, but that's what is in
        > their WSDL)
        >
        > I called the stub:
        > <snip>
        > use SecondaryCardOrder qw(:all);
        > my $seccardord = new SecondaryCardOrder;
        > </snip>
        >
        > Here's the XML that I was shown as an example output:
        > # <primaryCard>
        > # <CardNumber>string</CardNumber>
        > # <ExpiredDate>string</ExpiredDate>
        > # <CV2>string</CV2>
        > # </primaryCard>
        > # <receipent>
        > # <Receipent>
        > # <Param1>string</Param1>
        > # <Param2>string</Param2>
        > # <Param3>string</Param3>
        > # </Receipent>
        > # <LoadAmount>decimal</LoadAmount>
        > # <Message>string</Message>
        > # <OrderFee>
        > # <FeeType>string</FeeType>
        > # <Fee>decimal</Fee>
        > # </OrderFee>
        > # </receipent>
        >
        > These params are complex types, so I proceeded to build them as a
        > scalar
        > I've included an example of how I build "primaryCard", I used similar
        > methods
        > to build "receipent" and then tested them with Data Dumper just to be
        > sure they looked OK.
        >
        > <code snippet of building xml>
        > my $primaryCard = ( SOAP::Data->name("primaryCard" =>
        > \SOAP::Data->value(
        > SOAP::Data->name("CardNumber" => '0000111122223333'),
        > SOAP::Data->name("ExpiredDate" => '12/09'),
        > SOAP::Data->name("CV2" => '111')
        > ))
        > );
        > </code snippet of building xml>
        >
        > ...and then call the function
        >
        > <snip>
        > my $svcresult = $seccardord->OrderSecondaryCard( "primaryCard" =>
        > $primaryCard,
        > "receipent" =>
        > $receipent );
        > </snip>
        >
        > So...
        > when I set debug on SOAP::lite and trace, the resulting XML that gets
        > posted
        > will only use the second param. only the "receipent" fields get
        > filled in
        > and the "primaryCard" is empty. I thought maybe something was wrong
        > with how I built the XML, so I swapped the variables
        >
        > <snip>
        > my $svcresult = $seccardord->OrderSecondaryCard( "primaryCard" =>
        > $receipent,
        > "receipent" =>
        > $primaryCard );
        > </snip>
        >
        > and the output had the same result. the primaryCard area was empty,
        > and the receipent
        > area had the primaryCard information filled in just fine. Wierd.
        >
        > am I calling the function wrong? should I use arrays instead of
        > scalars when calling
        > the stub? I'm stuck.
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.