|
| Hello ,
I have a problem on Biztalk mapping, about Loop!
I have the request XML that can change in base of number of Passenger type.
<OTA_TestRQ xmlns="http://test.OTA_TESTRQ" >
<Record>
<Count>2</Count>
<Type>Adult</Type>
</Record>
<Record>
<Count>1</Count>
<Type>Child</Type>
</Record>
</OTA_TestRQ>
The response XML is simple. It has the same tag Record and the field Result
<ns0:Root >
<Record>
<Result>7</Result>
</Record>
</ns0:Root>
The algoritm for calculate the result is this :
If Type=Adult then
If count=1 then Result=1
If count=2 then Result=2 & Result=3
If count=3 then Result=4
End if
If Type=Child then
If count=1 then Result=7
If count=2 then Result=8
End if
So
if there is (in request XML) a Record with Type=Child then the response is 7 or 8. And so only one Record tag must be created.
<ns0:Root >
<Record>
<Result>8</Result>
</Record>
</ns0:Root>
If there isnt (in request XML) a Record with Type=Child the response is like the previous case, but if Count=2 (only if Count=2. For different Count the Record tag must be ONE!) I must create two Record count :
<ns0:Root >
<Record>
<Result>2</Result>
</Record>
<Record>
<Result>3</Result>
</Record>
</ns0:Root>
So..for make these different case of mapping I have used the Table Looping Shape.
For each case I use a Table Looping Shape.
So, if I have one Child, my table Looping Shape return one only loop on field Record of response XML.
Instead, If I havent Children, and the count of Adult is 2, my Table Loopinr return two loop on field Record of response.
The problem is :
With this shape (Table Loopin Shape) I can loop the tag Result in response XML, but not only for the case adult Count=2.
For all other case, I have always 2 tag Record looped (the first with the correct information, and the second empty.).
<ns0:Root xmlns:ns0="http://test.Schema2">
< Record >< Result >8</ Result ></ Record >
< Record ></ Record > <-- this is wrong!!
</ns0:Root>
Is There a way to Loop a Tag only if the Adult Count=2 ?? (I think is no possible, because if I connect a Loop Shape on a Tag of result XML, this is always looped).
There are other ways to solve this problem???
Thanks,
Francesco |
|