I receive a CancelLineItems message from System A. It may contain 1 to n
detail-line elements, one for each line item to be cancelled. I need to
send
1 to n CancelItem messages to System B. I don't remember how I found it
but
I found a sample Microsoft.BizTalk.Samples.LitWare in
....\SDK\Scenarios\B2B\. The ConfirmOrderWithVendors.odx orchestration in
that sample takes a purchase order that contains multiple order forms. It
processes the purchase order in a loop, extracting each order form one at
a
time and sending a message based on that order form to the vendor.
I built my CancelLineItem orchestration to do a similar thing. It takes in
the CancelLineItems message. Within the loop it creates a DetailLine
message
using a Construct Message shape containing a Message Assignment shape with
the following code:
detailLinePath =
System.String.Format("/*[local-name()='line-cancellation-request']/*[local-name()='cancelled-lines']/*[local-name()='detail-line'][{0}]",
cancelledLineIndex);
DetailLine = xpath(CancelLineItems, detailLinePath);
Then I have a map to map the DetailLine message to the SystemB CancelItem
message. It's in the map that I get into trouble because the original
CancelLineItems message had a namespace prefix defined - something BizTalk
seems to do be default, no? The resultant DetailLine message extracted
from
the CancelLineItems message has the namespace prefix in all the nodes, but
the namespace is undefined. The undefined namespace causes the map to
produce no output, resulting in a "Root element is missing" error at the
next step in the orchestration.
So I know what's wrong, but I have no idea how to fix it. Can I somehow
generate the DetailLine message with the namespace definition included in
it. If I start from what xpath returns to me, which is:
<ns1:detail-line>
<ns1:line-id>30</ns1:line-id>
<ns1:original-line-id>30</ns1:original-line-id>
<ns1:external-line-id>1</ns1:external-line-id>
<ns1:****pto-id>1</ns1:****pto-id>
<ns1:nbr-package-ids>0</ns1:nbr-package-ids>
<ns1:prefix>SI</ns1:prefix>
<ns1:item-root>0640</ns1:item-root>
<ns1:attribute-1>00</ns1:attribute-1>
<ns1:attribute-2>06</ns1:attribute-2>
<ns1:external-item-id>06400006 </ns1:external-item-id>
<ns1:item-description>GRAY GHOST STREAMER
</ns1:item-description>
<ns1:****pment-id>0</ns1:****pment-id>
<ns1:picking-batch-type>60</ns1:picking-batch-type>
<ns1:picking-batch-number>0000000</ns1:picking-batch-number>
<ns1:picking-batch-slot>0</ns1:picking-batch-slot>
<ns1:quantity-ordered>10</ns1:quantity-ordered>
<ns1:quantity-****pped>0</ns1:quantity-****pped>
<ns1:quantity-back-ordered>9</ns1:quantity-back-ordered>
<ns1:quantity-cancelled>1</ns1:quantity-cancelled>
<ns1:status>VC</ns1:status>
<ns1:gift-wrap-flag>false</ns1:gift-wrap-flag>
<ns1:gift-wrap-type> </ns1:gift-wrap-type>
<ns1:unit-cost>0.79</ns1:unit-cost>
<ns1:extended-price>17.55</ns1:extended-price>
<ns1:override-price>0.00</ns1:override-price>
<ns1:unit-special-freight>0.00</ns1:unit-special-freight>
<ns1:percentage-discount>0.000</ns1:percentage-discount>
<ns1:warehouse-id>0</ns1:warehouse-id>
<ns1:location-code> </ns1:location-code>
<ns1:order-date>2007-11-27</ns1:order-date>
</ns1:detail-line>
Is there any way from there to programmatically identify the prefix "ns1"
and add its namespace definition to the XML? Or do I need to work with
basic
string manipulation to parse out the "ns1" and insert the "xmlns:ns1=..."
text?
Thanks,
Zoe


|