Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Using repeating nodes from an input xml file to repeat a stored procedure
- This topic has 2 replies, 1 voice, and was last updated 9 years, 7 months ago by
community-content.
-
AuthorPosts
-
-
April 10, 2008 at 9:43 AM #19299
I want to put several customer records into a database. I have an input XML with a repeated CUSTOMER node for each record I want to create. I aso have a CREATE_CUSTOMER stored procedure that takes in information and writes a single customer to the database
I’m using an orchestration to map the infromation from the CUSTOMER node to a call to the CREATE_CUSTOMER stored procedure. But when I run the orchestration, only the first customer from the orginal input xml file is being put in the database.
Can someone tell me how to properly map the input xml file to the stored procedure so that the stored procedure is run for each CUSTOMER node in the input file?
-
April 11, 2008 at 2:36 AM #19304
Anonymous,
here are some options which rely on splitting *before* you get to the SQL insertion:
-
in a loop in an orchestration: a small assembly which knows treats the document as an XmlDocument and extracts each customer node. You need to keep a cursor somewhere. I have used this method and it works nicely. You could do this in an expression shape directly – but it’s a pig to test.
-
also in a loop: a map which knows how to map the customer node – you pass in the index. I’ve done this as a demo, but it was not pretty.
-
in a pipeline: you can make the customer be the contents of an envelope. BizTalk will spit out separate documents for each customer. This may work nicely for you, but it depends a bit on your case. Fiddly to set up, but no coding.
I’m pretty sure you can get your SQL adapter to this for you – but I don’t have any great experience with it. Also, if you need the customer separately for some other reason, then you still have to extract them.
John D.
-
-
April 13, 2008 at 4:20 PM #19321
You need two things to do:
1. Ensure your stored procedure (CREATE_CUSTOMER) node has an attribute maxOccurs=”unbounded”.
2. In the map use Looping functoid between Customer node in the source xml and CREATE_CUSTOMER.
And it doesn’t even necessary to use an orchestration in this case, but you can do it if you like.
Regards,
Nick
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.