“Untyped” receive ports in BizTalk Server 2004

Its not an uncommon request (in fact I got one in email today) to want to receive:

1. Non-XML data in a receive-port

2. XML messages of differing XML schemas within a single receive port

So how do you do that with BizTalk Server?

1. Set the messagetype property on your receive port to System.xml.xmldocument (yes I know in case 1 you are receiving non-XML data, but do it anyways)

2. Set-up a filter on the receive shape in orchestration which will pickup the message. Make sure you set your filter appropriately so you don’t pick-up all documents.

To access the data as a stream (if you want) then you can use this in an expression shape: 

XLANGPart.RetrieveAs( typeof(Stream) )

Credits to Yossi

Comments (10)

  1. Jason Welty says:

    Glad to see this posted.. very helpful, thanks.

    Also, for related issue search for thread titled ‘Distribution in BTS 2004’ on bt newsgroup at http://www.microsoft.com/biztalk/community

    this describes how to load a message if you only know a filename from within an orchestration, and can be ported to load any stream.

  2. Mark says:

    I assume this means that you can’t use promoted properties?

  3. Thanks for that hint! I was looking for this for a long time.

    However, I can’t get it working with a Web Service port while using the XML Reveive Pipeline. My intention was to use the pipeline to disassemble the message to get the namespace (message id) and then put it into the appropriate orchestration by filtering for the message id. When using a normal file port, this works fine. The message is decoded and the orchestration with the correct filter picks up the message.

    However, when I switch to a web service port (request-response with string type response) I get a pipeline exception: ‘Document type "order" does not match any of the given schemas’. I’m still submitting the same message (in a soap envelope of course) and the schema is still deployed.

    Switching to a pass through pipeline solves the problem but since the message id cannot be found I end up with a routing error.

    Strangely, if I remove the schema with the namespace "order" from my schema assembly, the error is also solved (with the XML pipeline activated) and the message is correctly delivered to the orchestration. But since my mappings expect a schema with a different namespace now, all mappings fail…

    Thanks for your support,


  4. Patrick Wellink says:

    Hello maybe you can help,

    i need to access the stream in the orchestration.

    in the post it is stated that :

    To access the data as a stream (if you want) then you can use this in an expression shape:

    XLANGPart.RetrieveAs( typeof(Stream) )

    But i can’t do that. Do i have to create a reference somewhere to do this.

  5. Scott posted a message back in June about untyped receive ports inside on Orchestration. Untyped Messages