In BizTalk Server development, many times you do not want to output a GUID string, but you want to use a date or a data item as the output file name.
In this article, we describe how to use dynamic ports to output filenames based on the current DateTime.
With dynamic ports, you can set the output file path in a BizTalk Orchestration by specifying Outport (Microsoft.XLANGs.BaseTypes.Address), where Outport is the name of the port that is created. The assignment of a port name is set in an expression.
This is illustrated by a simple example:
One, create an empty BizTalk Server Project Outfilename, set the assembly key file. For information on setting the assembly key file, refer to article 1.
Second, create a simple schema file, simpleschema.xsd, to set the type of message. and use the schema file to generate a Test.xml file for testing. For the creation of schemas, refer to document 2; For schema file generation instance files, refer to document 3;
Create a business process, add an orchestration, add a INMSG message to the process, and the type is Outfilename.simpleschema.
Iv. add a Receive Message action receivemsg, an expression setoutfilename, and a send message action sendmsg for the orchestration.
V. Add a inport port for the orchestration and receive the *. * file from the C:/in folder using the Microsoft.BizTalk.DefaultPipelines.XMLReceive pipeline.
Add a outport port for the orchestration, and use the Microsoft.BizTalk.DefaultPipelines.XMLTransmit pipeline to dynamically output the file.
Vii. Enter Outport (Microsoft.XLANGs.BaseTypes.Address) in expression setoutfilename = @ "file://c:/out/" + System.DateTime.Now.ToString ("YYYYMMDDHHMMSS") + ". xml"; code that dynamically sets the path of the output file.
Eight, connect the InPort port with the receivemsg, connect the outport port with the sendmsg, and set the receivemsg activation to ture.
Nine, compile and deployment of the project, put Test.xml into the C:/in folder below, will be produced under the C:/out folder an XML file, the file name is the current date time string.
Reference documents:
Document 1 Biztalk Troubleshooting required Strong Name Assembly Http://blog.csdn.net/fengfangfang/archive/2006/07/11/904725.aspx
Literature 2 How to quickly create a schema for Biztalk development http://blog.csdn.net/fengfangfang/archive/2006/07/04/874252.aspx
Document 3 validation http://blog.csdn.net/fengfangfang/archive/2006/07/04/874477.aspx of schemas and instances;