我必须以下列格式发送SOAP请求:
<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>
令人困惑的一点是如何使帐户和帐户层次结构在请求正文中处于同一级别。
我试过这样,这样:
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);
}
但它失败了,因为它只发送结构中定义的最后一个SOAP :: Data-&gt;值,在这种情况下为accountHierarchy
。
有人会非常友善,让我知道如何才能同时将account
和accountHierarchy
发送到同一级别?
答案 0 :(得分:0)
现在它的格式化,问题变得更加明显。
您正在为标量$params
分配两个值,并且只使用最后一个值,因为这是逗号运算符计算的最后一个语句。我的SOAP::Lite
知识非常生疏,所以我不确定你是否可以将它们都包装在一个数组ref中:
$params = [
SOAP::Data->name( accountHierarchy => ... ),
SOAP::Data->name( account => ... ),
];
或者您是否必须使用正确的SOAP::Lite
机制来创建一些匿名数组。但那会让你再次前进。
答案 1 :(得分:0)
答案是在顶部使用非ref SOAP :: Data-&gt;值...
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);
}
非常感谢!