Tallan's Technology Blog

Tallan's Top Technologists Share Their Thoughts on Today's Technology Challenges

Dynamically Reading Receive Location Context Properties

roliva

A situation present itself occur where an orchestration uses a receive port that is sourced by multiple receive locations to receive a message and a specific context property must be read from the incoming message. Because the message is coming from different receive locations, an evaluation of the to location may be necessary to determine the proper context property. For example, the following receive port is set up to accept an incoming message from four different receive locations:

In this example, the file is not only coming in from four receive locations, but each location is a different type (a windows folder, a SharePoint document folder, an FTP site or email). To get a file property such as the file name, an orchestration will need to read the context property ReceivedFileName associated with the specific receive location. When multiple locations are used as with the example above, some conditional logic is necessary to read the property from the correct received location. For the “FILE” receive location, the context property is “FILE.ReceivedFileName, for an FTP site, it’s “FTP.ReceivedFileName” and for Windows SharePoint Services, “WSS.FileName”. In this situation, the inbound transport type of the incoming message can be evaluated in an standalone Expression shape to determine the correct ReceivedFileName context property to read.

if (msgClientData(BTS.InboundTransportType) == “FILE”)

{

    fileName = msgClientData(FILE.ReceivedFileName);

}

else if (msgClientData(BTS.InboundTransportType) == “FTP”)

{

    fileName = msgClientData(FTP.ReceivedFileName);

}

else if (msgClientData(BTS.InboundTransportType) == “Windows SharePoint Services”)

{

    fileName = msgClientData(WSS.Filename);

}

else

{

    fileName = msgClientData(BTS.MessageID);

}

In this code fragment, the specific context property associated with the receive location is read for “FTP”, “FILE” and “WSS” receive location types. If the file is received from any other location, the filename variable is defaulted to the Message ID. Again, this code can only be used in a standalone Expression shape since Boolean (if-else) logic is not allowed inside a Construct Message shape.

In addition, not all receive locations contain the same property sets. For example the “FILE” receive location, contains a context property to determine the date/time of when the file was received whereas the “FTP” location does not have that property. The logic above can be expanded to accommodate these variations amongst to context properties between receive locations as well.

Tags: BizTalk,

2 Comments. Leave new

Hi ZaneIt’s tricky liltte beast to get working. The problem will almost certainly be in your security settings either the browser or how SharePoint has been configured. One possible option would be to configure the content query web part externally, then import it into SharePoint. It’s just an XML file when all is said and done. Haven’t given this a try (will when I’ve got one of the VMs powered up), but drop a CQWP onto page, type something so it has some HTML content. Then export to your desktop. From the desktop, right-click and open in Notepad or similar. You’ll see all the XML tags storing the properties and content of the CQWP. You should be able to find the line containing the HTML content. Insert what you need there and then try importing back in.

I am new to biztalk… where do i put this code? thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

\\\