Introduction

This is a very simple tutorial on how to debatch an XML message in the receive pipeline in BizTalk.

Steps To Follow

  1. Create a new BizTalk Project (I called mine "SimpleDebatching") but you can name it anything you want, it won't impact any other code in this tutorial
  2. Right click your project in the "Solution Explorer" and choose "Add" and "New item..."
  3. Click once on "Schema" and add a friendly name to it. I called mine "Orders"
  4. Rename the "Root" name into "Order".
  5. Right click the root name "Order" and choose "Insert Schema Node" and "Child Field Element"
  6. Do step 5 a total of four times with the following names "orderId", "orderDate", "orderPrice" and "orderStatus"
  7. If you now open the schema we named "Orders" and expand all the elements it will look like this

    Schema image
  8. And now a pet on your back, you're doing great
  9. Now that we've come so far we need to understand the meanings of an envelope, people will trick you and tell you some technical ways of it.. Don't mind them. its like any envelope, it has something in it, one or multiple papers/records.
  10. In the "Solution Explorer" right click the project and choose "Add" and "New Item..."
  11. Again, click once on "Schema" and give it a friendly name. In this case I called it "OrdersEnvelope"
  12. The "Schema Editor" pops up and we can see the root name is... "root".
  13. Rename the root name into "OrderEnvelope"
  14. Right click "OrderEnvelope" and choose "Insert Schema Node", and choose "Child Record"
  15. Name this child record "Orders"
  16. Get a cup of Coffee...
  17. Right Click the node "Orders" and choose "Insert Schema Node", and choose "Any Element"
  18. Now click once on the "<Schema>" and take a look at the "Properties" window
  19. Locate the option "Envelope" change this from "(Default)" to "Yes" (do this for the "OrdersEnvelope" schema)
  20. Now go to the root node (OrderEnvelope) in the "OrdersEnvelope" schema and look at the "Properties" window again, find the "Body XPath"
  21. click the "magic/ellipse" button and drill till you see "Orders"

    no need to write code
  22. Choose "Orders" and click "OK".
  23. Pooof, and your schema "OrderEnvelope" is updated with the correct XPath
  24. Look at your self, and understand we still haven't written one sentence of code..
  25. Go back to the "Solution Explorer" and right click the solution "SimpleDebatching", choose "Add" and "New Item" and pick the "Receive Pipeline" name this "ReceiveAndDebatch"
  26. The Pipeline Component "drag and drop windows" appears.
  27. Expand the "Toolbox" windows and drag the "XML Disassembler" and drop it on the "Disassembler in the main window
  28. Click the newly added XML Disassembler and look at the properties window and find "Document Schema" click the ellipse button and locate your document schema "Orders"
  29. When you find this, click on it and hit the "Add" button, you will see the schema moving from the left window to the right
  30. Click "OK"
  31. Do the same with "Envelope Schema" but locate the "OrdersEnvelope" schema instead
  32. Click "Add" and "OK"
  33. Now in order for us to deploy this code to BizTalk we need to do a few things
  34. Look at the "Solution Explorer" and right click the "Solution" Choose "Properties"
  35. In the "Properties window" that appear click "Deployment"
  36. Update the "Application Name" to "SimpleDebatching"
  37. Now we need to sign our assembly, so click the "Signing" and tick the box that says "Sign the assembly"
  38. From the drop down choose "<new...>" and create a new key
  39. Hit "CTRL+S" to save it
  40. Now back in the "Solution Explorer" right click it and choose "Deploy"
  41. Your code will now be deployed to your environment
  42. Open "BizTalk Administration Console" and locate your application "SimpleDebatching"
  43. Create a new Receive Port and name it "ReceiveDebatchPort"
  44. Create a receive location for this Receive Port and name it "ReceiveDebatchLocation"
  45. Update the receive pipeline to your newly created recive pipeline "ReceiveAndDebatch"
  46. Create a new send port and name it "SendDebatch"
  47. Update the send pipeline to "XMLTransmit"
  48. Add a filter to your Receive Port by chchoosingBTS.ReceivePortName" and the value "ReceiveDebatchPort"
  49. Now restart your host instance and start the application.
  50. You can create a test message by generating an instance from the schema "OrdersEnvelope"
  51. Replace the "<any>" tag with a generated instance from the "Orders" schema (the more you add, the more records)
  52. Put the file in the in folder and see what happens.

See Also

Another important place to find an extensive amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalkServer Resources on the TechNet Wiki.