I have to send a SOAP request in the following format:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:acc="...">
<soapenv:Header/>
<soapenv:Body>
<acc:CreateChildSubscriptionAccount>
<account>
...
</account>
<accountHierarchy>
...
</accountHierarchy>
</acc:CreateChildSubscriptionAccount>
</soapenv:Body>
</soapenv:Envelope>
The confusing point is being on how to make account and accountHierarchy to be at the same level in the request body.
I've tried so, this way:
sub callservice{
...
$params =
SOAP::Data->name(
'accountHierarchy' => \SOAP::Data->value(
SOAP::Data->name( 'customerId' => '250001' ),
SOAP::Data->name( 'currencyCodeId' => \SOAP::Data->value(
SOAP::Data->name( 'domain' => 'ACC' ),
SOAP::Data->name( 'value' => 'EUR' )
) )
)
),
SOAP::Data->name(
'account' => \SOAP::Data->value(
SOAP::Data->name( 'customerId' => '250001' ),
SOAP::Data->name( 'languageCodeId' => \SOAP::Data->value(
SOAP::Data->name( 'domain' => 'ACC' ),
SOAP::Data->name( 'value' => 'en' )
) ),
SOAP::Data->name( 'lifeCycleProgression' => \SOAP::Data->value(
SOAP::Data->name( 'lifeCycleEntry' => \SOAP::Data->value(
SOAP::Data->name( 'lifeCycleSubState'=> 'STD' ),
SOAP::Data->name( 'lifeCycleReasonCode'=> 'ADD' ),
SOAP::Data->name( 'lifeCycleState'=> 'ACTIVE' )
) )
)),
SOAP::Data->name( 'paymentResponsibility' => 'true' ),
SOAP::Data->name( 'accountName' => 'TLA13134' ),
SOAP::Data->name( 'accountType' => 'CONVERGENT' )
)
);
$response = $service->call("createChildSubscriptionAccount", $params);
}
but it is failing, as it only sends the last SOAP::Data->value defined in the structure which is accountHierarchy
in this case.
Would anyone be kind enough and let me know how can I achieve to send both account
and accountHierarchy
at the same level?
The answer is to use a non-ref SOAP::Data->value on top...
sub callservice{
...
$params =
SOAP::Data->value(
SOAP::Data->name(
'accountHierarchy' => \SOAP::Data->value(
SOAP::Data->name( 'customerId' => '250001' ),
SOAP::Data->name( 'currencyCodeId' => \SOAP::Data->value(
SOAP::Data->name( 'domain' => 'ACC' ),
SOAP::Data->name( 'value' => 'EUR' )
) )
)
),
SOAP::Data->name(
'account' => \SOAP::Data->value(
SOAP::Data->name( 'customerId' => '250001' ),
SOAP::Data->name( 'languageCodeId' => \SOAP::Data->value(
SOAP::Data->name( 'domain' => 'ACC' ),
SOAP::Data->name( 'value' => 'en' )
) ),
SOAP::Data->name( 'lifeCycleProgression' => \SOAP::Data->value(
SOAP::Data->name( 'lifeCycleEntry' => \SOAP::Data->value(
SOAP::Data->name( 'lifeCycleSubState'=> 'STD' ),
SOAP::Data->name( 'lifeCycleReasonCode'=> 'ADD' ),
SOAP::Data->name( 'lifeCycleState'=> 'ACTIVE' )
) )
)),
SOAP::Data->name( 'paymentResponsibility' => 'true' ),
SOAP::Data->name( 'accountName' => 'TLA13134' ),
SOAP::Data->name( 'accountType' => 'CONVERGENT' )
)
)
);
$response = $service->call("createChildSubscriptionAccount", $params);
}
Thanks a lot!