Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6597783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:15:10+00:00 2026-05-25T18:15:10+00:00

So the basic XML I’m trying to create is this (header stripped for brevity).

  • 0

So the basic XML I’m trying to create is this (header stripped for brevity).

<SOAP-ENV:Body><data:requestMessage xmlns:data="urn:schemas-cybersource-com:transaction-data-1.62">
<data:merchantID>obfuscated</data:merchantID>
<data:merchantReferenceCode>42</data:merchantReferenceCode>
<data:billTo><data:firstName>caleb</data:firstName>
   <data:lastName>cushing</data:lastName><data:street1>somewhere</data:street1>
   <data:city>houston</data:city>
   <data:state>TX</data:state>
   <data:postalCode>77064</data:postalCode>
   <data:country>US</data:country>
   <data:email>xenoterracide@gmail.com</data:email>
</data:billTo>
 <data:item id="0">
   <data:unitPrice>2.01</data:unitPrice>
   <data:quantity>1</data:quantity>
</data:item>
<data:item id="1">
   <data:unitPrice>3</data:unitPrice>
   <data:quantity>1</data:quantity>
</data:item>
<data:purchaseTotals>
   <data:currency>USD</data:currency>
   <data:grandTotalAmount>5.01</data:grandTotalAmount>
</data:purchaseTotals><data:card>
    <data:accountNumber>4111111111111111</data:accountNumber>
    <data:expirationMonth>12</data:expirationMonth>
    <data:expirationYear>2015</data:expirationYear>
</data:card><data:ccAuthService run="true"/>
</data:requestMessage></SOAP-ENV:Body>

Here’s the Perl

#!/usr/bin/perl
use v5.14;
use strict;
use warnings;
use Env qw( CYBS_ID CYBS_KEY );
use XML::Compile::Util qw( pack_type type_of_node );
use XML::Compile::Cache;
use XML::Compile::SOAP::WSS;

use XML::Compile::WSDL11;
use XML::Compile::SOAP11;
use XML::Compile::Transport::SOAPHTTP;

my $wss = XML::Compile::SOAP::WSS->new( version => '1.1' );


my $wsdl = XML::Compile::WSDL11->new( 'CyberSourceTransaction_1.62.wsdl' );

$wsdl->importDefinitions( 'CyberSourceTransaction_1.62.xsd' );

my $call = $wsdl->compileClient('runTransaction');

my $security = $wss->wsseBasicAuth( $CYBS_ID, $CYBS_KEY );

my ( $answer, $trace ) = $call->(
    wsse_Security         => $security,
    merchantID            => $CYBS_ID,
    merchantReferenceCode => '42',
    billTo => {
        firstName  => 'caleb',
        lastName   => 'cushing',
        street1    => 'somewhere',
        city       => 'houston',
        state      => 'TX',
        postalCode => '77064',
        country    => 'US',
        email      => 'xenoterracide@gmail.com',
    },
    item => {
        id => 0,
        quantity => 1,
        unitPrice => 2.01,
    },
    item => {
        id => 1,
        quantity => 1,
        unitPrice => 3.00,
    },
    purchaseTotals => {
        currency         => 'USD',
        grandTotalAmount => 5.01,
    },
    card => {
        accountNumber => '4111111111111111',
        expirationMonth => '12',
        expirationYear  => '2015',
    },
    ccAuthService => {
        run => 'true',
    },
);

$trace->printRequest;
say '---';
$trace->printResponse;

Here are the WSDL and XSD

Below is the XML that is being generated. Obviously I only get the second item. How can I create a request that has more than one item?

<SOAP-ENV:Body><data:requestMessage xmlns:data="urn:schemas-cybersource-com:transaction-data-1.62">
<data:merchantID>obfuscated</data:merchantID>
<data:merchantReferenceCode>42</data:merchantReferenceCode>
<data:billTo><data:firstName>caleb</data:firstName>
   <data:lastName>cushing</data:lastName><data:street1>somewhere</data:street1>
   <data:city>houston</data:city>
   <data:state>TX</data:state>
   <data:postalCode>77064</data:postalCode>
   <data:country>US</data:country>
   <data:email>xenoterracide@gmail.com</data:email>
</data:billTo>
 <data:item id="1">
   <data:unitPrice>3</data:unitPrice>
   <data:quantity>1</data:quantity>
</data:item>
<data:purchaseTotals>
   <data:currency>USD</data:currency>
   <data:grandTotalAmount>5.01</data:grandTotalAmount>
</data:purchaseTotals><data:card>
    <data:accountNumber>4111111111111111</data:accountNumber>
    <data:expirationMonth>12</data:expirationMonth>
    <data:expirationYear>2015</data:expirationYear>
</data:card><data:ccAuthService run="true"/>
</data:requestMessage></SOAP-ENV:Body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:15:10+00:00Added an answer on May 25, 2026 at 6:15 pm

    You try to have multiple keys with the same name in the HASH, which, of course, is not possible. With $wsdl->explain($op, recurse => 1) you can easily figure-out how the data-structure should look like…

    For simple repetative elements, you use and array:

      item => [ { id => 0, quantity => 1, unitPrice => 2.01, },
                { id => 1, quantity => 1, unitPrice => 3.00, }, ]
    

    Nicer:

     $items[0] = { id => 0, quantity => 1, unitPrice => 2.01, };
     $items[1] = { id => 1, quantity => 1, unitPrice => 3.00, };
     $data = { ..., item => @items, ... };
    

    Even easier when the items are objects… see typemap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying a very basic XPath on this xml (same as below), and it
I'm trying to create an element in an XML where the basic content is
I am trying to load a very basic XML document but everytime I get
I use MyGeneration along with nHibernate to create the basic POCO objects and XML
Trying to do a basic XML retrieval. The code works as expected in Firefox
What is basic need of xml transformation? In which situation we can use this
In this case I have XML data source and external images files whole together
I'm trying to make a simple xml-editor for some basic but specific needs, the
Little confused, the basic spring mvc app has this: app-config.xml <context:component-scan base-package=org.springframework.samples.mvc.basic /> and
I have some very basic XML: <ArrayOfString xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema> <string>One</string> <string>Two</string> </ArrayOfString> How can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.