0

I have tried to send request to BizTalk server via SOAP connection from Magento e-commerce system. For sending request, I prepared array, that converted to XML on BizTalk server. I have a big array, so I show what the array I have prepared, how converted my array on server and which xml I expected after converting.

I need to send xml with this nodes

<UnitPrice>
    <Amount currencyID="PLN">20.0000</Amount> 
    <PerQuantity>1</PerQuantity>
</UnitPrice>

I have prepared this array

"UnitPrice" => array(
    "Amount" => "20.0000",
        array("currencyID" => "PLN"),
    "PerQuantity" => "2")

After sending this to server, i see in last request, that my array was converted like here

<ns1:UnitPrice>
    <ns1:Amount currencyID="PLN"/>
    <ns1:PerQuantity>2</ns1:PerQuantity>
</ns1:UnitPrice>

OR

<ns1:UnitPrice>
    <ns1:Amount>20.0000</Amount>
    <ns1:PerQuantity>2</ns1:PerQuantity>
</ns1:UnitPrice>

I have tried to send different arrays, but all the time in node converts either attribute or value.

Please answer who know how prepare array with attributes and values for correct request.

1 Answer 1

0

I has found where was my problem.

When we send array request to Biztalk server via SOAP, we need to use this format of array

"UnitPrice" => array(
   "Amount" => array("_" => "20.0000","currencyID" => "PLN"),
   "PerQuantity" => "2"),
  • In "_" we set value for node
  • In "currencyID" we set an attribute for node.

Final request that converted on server is

<UnitPrice>
    <Amount currencyID="PLN">20.0000</Amount> 
    <PerQuantity>2</PerQuantity>
</UnitPrice>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.