This is probably the most blogged topic in the BizTalk community but I hope my attempt still adds something.
Let’s start with some simple questions:
Question1:
What syntax do you need to use to access the filename of a message you received using the file adapter in an orchestration?
In an expression shape you use something like this:
myVariable = myMessage(File.ReceivedFileName);
Question 2:
Ok, that one was easy! Now the same question for the a message received using the FTP adapter?
Again in an expression shape use:
myVariable = myMessage(FTP.ReceivedFileName);
Question 3:
Ok, makes sense. So what do you need to do when you wan to set the filename for a message that you send out using the file adapter?
Easy, two steps needed:
1). Set the filename property in the send port to use the macro %SourceFileName%.
2). Set the context property in the orchestration to the filename you want to use, like this:
myMessage(FILE.ReceivedFileName) = “MyFileName.xml”;
The file adapter will replace the macro with the value of the context property.
Question 4:
Last question; Same question for the FTP adapter. How do you set the filename for a message that you want to send out using the ftp adapter?
myMessage(FTP.ReceivedFileName) = “MyFtpFileName.xml”;
Wrong!!!!!!!! you also need to use the same syntax as with the file adapter:
myMessage(FILE.ReceivedFileName) = “MyFtpFileName.xml”;
This is something I encountered during development last week. I think this is a little confusing. It took me a while to find out what happened here. Also, by searching the internet, if found out this seems to confuse more people.
I think the idea behind this is an attempt to make an orchestration adapter agnostic and to create an abstraction layer between the logical process (orchestration) and the adapters which are bound to a certain technology or protocol. So whether you use the file or FTP adapter it is always ‘FILE.ReceivedFileName’ you need to use. This idea is good but my remarks are:
- This works different for receive side which makes it a little inconsistent.
- The word ‘FILE’ is (at least in my head) directly connected to the file adapter. The abstraction would be more clear if some other term was used.
Confusing!