by community-syndication | Jul 7, 2006 | BizTalk Community Blogs via Syndication
Microsoft has introduced BizTalk 2006 R2. This product refresh includes a number of interesting features and enhancements to improve compatibility with Windows Vista and Microsoft Office 2007. Let’s have a look.
%u00b7 Microsoft EDI Solution for BizTalk 2006
Microsoft’s EDI Solution for BizTalk adds full featured EDI capabilities to BizTalk 2006 with over 6000 schemas that include HIPAA, X12, and EDIFACT support.
Microsoft is highly committed to the B2B space with a dedicated team focusing on B2B messaging solutions integrated with the BizTalk Architecture. This EDI solution joins a group of solutions delivered with BizTalk 2006 including HIPAA, HL7, SWIFT, RosettaNet, cXML, and xCBL.
Microsoft’s goal is to drive Customer value by:
Reducing TCO of managing B2B relationships
Increase agility in establishing new B2B relationships
Improve the timeliness and effectiveness of B2B decision making
Find more info at: Microsoft EDI Solution Infosheet
%u00b7 Microsoft RFID
The Microsoft RFID Infrastructure Services in BizTalk 2006 R2 provide device abstraction and manageability to RFID-based solutions. An integrated engine for rich data filtering, enrichment, and transformation allows for sophisticated applications for different automation scenarios. Application developers can also integrate with advance technologies such the as the Business Rules Engine, Windows Workflow Foundation, and Windows Communication Framework to create state-of-the-art business end-to-end systems.
Find more info at: BizTalk 2006 R2 – RFID Support
%u00b7 BizTalk Adapter for Windows Communication Foundation (WCF)
The BizTalk WCF (Windows Communication Foundation) Adapters align BizTalk with Microsoft’s Web Services strategy by exposing WCF channels to BizTalk processes.
The BizTalk R2 will contain the following WCF Adapters
%u00b7 WsHttp Adapter – provides the WS-* standards support over HTTP transport. WCF-WsHttp adapter provides a transport/protocol stack implementation compatible with other next generation Web Services (platforms that also implement the same Web Services Architecture standards). It provides full access to SOAP security, reliability, and transaction features. This adapter uses the HTTP or HTTPS transport, and messages have a text or Message Transmission Optimization Mechanism (MTOM) encoding
%u00b7 NetTcp Adapter – provides the WS-* standards support over TCP transport. WCF-NetTcp adapter provides efficient communication in a .NET to-.NET environment. It provides full access to SOAP security, reliability and transactions features. This adapter uses the TCP transport and messages have binary encoding.
%u00b7 WCF-NetMsmq Adapter – provides queued messaging using MSMQ transport. WCF-NetMsmq adapter provides queued communication in a .NET-to-.NET environment. It uses MSMQ transport, and messages have a binary encoding
%u00b7 WCF-BasicHttp – compatible with first generation web services. WCF-BasicHttp adapter provides a transport/protocol stack implementation compatible with first-generation Web Services. This adapter uses the HTTP or HTTPS transport, and messages have a text encoding.
%u00b7 WCF-NetNamedPipe – provides cross process messaging using NamedPipes transport. WCF-NetNamedPipe adapter provides efficient cross-process communication in a .NET-to-.NET environment. This adapter provides full access to SOAP reliability and transaction features. The adapter uses the named pipe transport and messages have a binary encoding. This adapter cannot be used in cross-machine communication.
%u00b7 WCF-Custom – provides customization for using WCF components (bindings, behaviors and binding elements). WCF-Custom adapter is used to enable usage of WCF extensibility components in BizTalk Server. The adapter enables complete flexibility of the WCF framework. It allows users to select and configure a WCF binding for the receive location/send port. It allows users to set the endpoint behaviors and security settings.
%u00b7 WCF-CustomIsolated – provides customizations for using WCF components (bindings, behaviors and binding elements) and using the HTTP transport. WCF-CustomIsolated adapter is used to enable usage of WCF extensibility components in BizTalk Server, but out of proc in IIS. The adapter enables complete flexibility of the WCF framework. It allows users to select and configure a WCF binding for the receive location/send port. It allows users to set the endpoint behaviors and security settings. This adapter should only be used by transports than can be hosted in IIS.
Find more info at: BizTalk WCF Adapters
%u00b7 R2 Adapter Framework for .NET 3.0
The framework provides a common basis for building integration adapters that can be consumed by a variety of client applications (BizTalk, Office, .Net, etc) and usage scenarios via .NET 3.0 (formally WinFX). The Adapter Framework aligns the adapters strategy with Microsoft’s Web Services strategy by exposing integration adapters as WCF (Windows Communication Foundation) channels.
Find more info at: R2 Adapter Framework for .NET 3.0
%u00b7 R2 Line of Business (LOB) Adapters for .NET 3.0
The WCF LOB adapters deliver application, database and transport adapters to customers, implementing a common Adapter Framework, which in turn is built on top of the Windows Communication Framework (SAP, Siebel, Oracle DB, and TIBCO RV).
An adapter is fundamentally a module that bridges a client program and an external system, exposing well-defined and standardized interfaces over various programming models to the client program while internally mapping them to proprietary interfaces and protocols supported by the external system.
Application adapters provide an interface to Line-of-Business (LOB) systems like SAP, Siebel, Oracle Financials, PeopleSoft and JD Edwards. Database adapters provide an interface to database systems like Oracle, SQL Server, Sybase and DB2. Transport adapters provide an interface to transport protocols like HTTP and FTP and message-oriented middleware (MOM) like Tibco, Websphere MQ and MSMQ.
The R2 LOB Adapters deliver application, database and transport adapters by implementing a common Adapter Framework, which in turn is built on top of the Windows Communication Framework (WCF). Technically the R2 LOB adapters are exposed as WCF transport channels to clients, enabling connectivity, metadata exchange and business data exchange with external systems.
The R2 LOB adapters make line-of-business applications, databases and messaging platforms visible and interoperable with standard business processes, workflows and .NET applications They promote reusability and “plug ’n play” across disparate applications. Different programming models can be built on top of the WCF adapter framework giving client programs the choice of programming models based on business needs. ADO.NET, WCF proxy programming and WCF channel (message-level) programming are a few programming models. The adapter framework eases adapter development in terms of providing simplified abstractions that handle common infrastructure and plumbing aspects of adapter building besides providing common runtime services. This enables adapter writers to focus on business logic required to interface with and surface external system functionality. It also empowers partners to develop custom adapters. The choice of WCF is essentially inline with Microsoft’s next generation communication framework optimized for the web services enabled world. It automatically web service enables external systems that are being adapted using R2 LOB adapters.
%u00b7 BAM interceptors for Windows Workflow Foundation (WF) and WCF
How do I Participate in the BizTalk R2 TAP?
If you are interested in participating in the BTS 2006 R2 TAP please review the Program Description and submit a completed BizTalk 2006 R2 Nomination Form and a TAP Program Manager will contact you. Once you have been accepted in to the TAP you will be able to download all R2 beta builds.
Nomination forms will be reviewed and BTS 2006 R2 TAP participants will be selected by July 31st, 2006.
What is a TAP (Technology Adoption Program)?
The BizTalk Server 2006 R2 Technology Adoption Program (TAP) is an “early adopter” program intended to validate the quality of the new features included in BTS 2006 R2 as well as give Customers and Partners early access to these features in order to validate functionality and quality prior to release.
In order to provide the best support possible during BTS 2006 R2 TAP we will be limiting the number of customers that we accept into this program so that we can maintain the highest possible quality for our participants.
%u00b7 Program Participation
Registration for the BTS 2006 R2 TAP program is available by invitation of Microsoft account team members or by submitting a completed Nomination form that is available on the BizTalk Server 2006 R2 TAP website welcome page (also available in Downloads section)
Customers are then selected based on acceptance criteria as follows:
%u00b7 A funded project that incorporates BizTalk Server 2006 R2 features
%u00b7 The ability to commit the resources required to design and implement a solution using BizTalk Server 2006 R2 features
%u00b7 The ability to release the solution to production 6 weeks prior to BizTalk Server 2006 R2 releases
%u00b7 Provide high-quality feedback on BizTalk Server 2006 R2 features
%u00b7 Ability to attend regularly scheduled calls (bi-weekly)
%u00b7 Potential to participate in a Lab Engagement in Redmond, WA
All BizTalk Server 2006 customers are eligible to participate in this Technology Adoption Program and we are interested in your participation if you meet the criteria listed above.
Customers and Partners who enjoy being on the cutting edge of technology and who can benefit from these new features will find value in taking part in this TAP program.
%u00b7 Program Structure
Nomination – Customers can nominate themselves on the BizTalk Server 2006 R2 Connect website by completing the TAP Nomination Form found on the welcome page (also available in Downloads section). The BTS R2 TAP Team will review all Nomination forms that we receive and will contact candidates as their Nominations are accepted/rejected.
Note that a Premier Support Agreement is required for participation on projects going into production.
Engagement – After being accepted into BizTalk Server 2006 R2 TAP, the TAP Team will work with TAP Participants to review architecture, test, and project plans. During this time most of the documentation and legal paperwork is signed. In addition, the TAP Participant’s expectations of the program are clearly documented and provides a means to clearly evaluate success.
Development / Test – Selected builds will be delivered to TAP Participants for testing and development. Issues brought by TAP Participants are handled by a trained Support Specialist and members of the Product Team. In some cases, developers or testers of a specific feature will work with a TAP Participants to ensure that technical issues are resolved accurately and timely.
Production Roll-Out – TAP Participants should plan on deploying their BTS 2006 R2 project to production no later than 6 weeks prior to the scheduled RTM date and be prepared to sign-off on production worthiness 2 weeks prior to RTM.
For customers that have a premier support agreement, support resources are available “7×24.”
Post-Mortem – When the program draws to a close, your feedback regarding the program in which you took part is critical to our ability to continually improve future programs.
by community-syndication | Jul 6, 2006 | BizTalk Community Blogs via Syndication
Web Site: http://www.impactevents.com/biztalkconference
Microsoft’s SOA & Business Process Conference is the event for our partners, customers and field personnel to get up to speed on new and updated solutions for Business Process Management (BPM), SOA and Workflow. Over 4 days, attendees will learn about the strategies and technologies that Microsoft is delivering over the next year, such as BizTalk Server, WinFX, and Office 2007. Three technical tracks will provide depth and detail into best practices for building BPM solutions, SOA guidance, and implementing BizTalk Server. A business development track will focus on the business value of BPM for both customers looking to optimize their processes and for partners looking to expand their practices. Whether you need to get up to speed, or are ready to dive deep, this is the event for technical training, networking, and business development for partners and customers interested in BPM, SOA, and Workflow.
Registration
Join Microsoft staff, valued partners, customers and industry thought leaders at the Microsoft Conference Center from October 3-6, 2006. Registration is $199.00, with an early bird discount price of$149.00 if you register by July 21st.
Agenda & Sessions
Each session, meeting, and program event at the Microsoft SOA & Business Process Conference is designed to expand your knowledge of key emerging technologies, demonstrate proven strategies for implementing solution, explain Microsoft’s long-term strategy and roadmap, and add value to your organization’s integration and workflow solution portfolio.
Sponsors & Exhibitors
Over 20 Microsoft partners are expected to showcase their latest solutions and technologies demonstrating their newest innovations- allowing attendees to test-drive key technologies and receive one-on-one, informed answers to questions.
If you are interested in sponsorship, please contact Robert Bannerman at [email protected].
Community & Networking
Beyond the structured sessions, the Microsoft SOA & Business Process Conference will also provide many networking opportunities with people who share your professional interests. We will be hosting several evening events to help encourage and foster community-building activities between partners, customers, and Microsoft employees. Throughout the year be sure to check out the community sites to access the most current information.
Instructor Lead Training
Conference sponsor and BizTalk Server training partner, Quicklearn, is offering a series of classes before and after the conference for the convenience of attendees. Furthermore Quicklearn is providing a 35% discount for conference attendees. Use the links below to find out about the specific classes and to register. Make sure to include the discount Registration code: ’BPI06’ when you register for one of these classes.
9/25-9/29 (5-days) – BizTalk Server 2006 Deep Dive
9/30-10/2 (3-days) – BizTalk Server 2006 – Service Oriented Architectures (SOA)
10/9-10/13 (5-days) – Double Header – Windows Workflow Foundation (WF) & Windows Communication Foundation (WCF)
Web Site: http://www.impactevents.com/biztalkconference
by community-syndication | Jul 5, 2006 | BizTalk Community Blogs via Syndication
I recently took a look at using Windows Workflow Foundation to create a simple Human Workflow to manage a procurement process on SharePoint Portal Server. So I set about integrating SharePoint Portal Server (SPS), InfoPath and Windows Workflow Foundation to achieve this goal was it easy well yes.
Here are the blog entries I can remember which really helped me out.
Which Style of Workflow When
Windows Workflow + SharePoint 2003 + BizTalk Scenario Built Out (Unfortunately SharePoint Portal Server is not .net 2.0 compatible whereas SharePoint Services are)
Adventures with Windows Workflow – Hosting a Workflow with Tracing and Persistence
Windows Workflow Foundation ASP.Net State Machine
Basic user experience:
The InfoPath form was vaguely similar to the Purchase Request form which comes with InfoPath as a template.
- Go to a SharePoint form library and enter a procurement request using an InfoPath form and submit it
- An approver would then receive an email with a link to the InfoPath form asking them to click the link and then approve or reject the procurement they open the form, approve, reject and then submit it
- Reject send email with form link back to requester
- Approve send email to a higher approver or a PO issuer with form links they open the form, enter the PO number and then submit it
Note:
Only an approver can approve, only a PO issuer can issue PO numbers
I didn’t need to write a single line of code to create the InfoPath form it was super easy.
How it’s done
SharePoint Portal Server Event Sinks
As SPS 2003 is not .net 2.0 compatible I hosted my Win WF State Machine in an ASP.net 2.0 Web Service (I am going to go into greater detail of how to do this below).
I registered an ASP.net 1.0 event handler class (see following code) in the advanced settings of my Procurement Form Library on SPS. Each time an InfoPath from is saved or submitted this event handler is called. This just calls the ASP.net 2.0 Web Service passing the SPS site URL and the InfoPath file url so the State Machine can access, read and update properties on the InfoPath form.
Note you could just as easily not use the SPS event sink and call the web service from an InfoPath form, using the event sink just gave me an easy way of passing the SPS site URL and the InfoPath file url (from the SPListEvent arguement) to my Win WF hosting Web Service so I could gain control of the InfoPath form inside the state machine and modify it’s xml etc.
using System;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using Microsoft.SharePoint;
using System.Security.Principal;
namespace Synergy.Procurement.Net1
{
public class SPEventHandler : Microsoft.SharePoint.IListEventSink
{
void IListEventSink.OnEvent(Microsoft.SharePoint.SPListEvent spEvent)
{
WindowsImpersonationContext wic = WindowsIdentity.GetCurrent().Impersonate();
try
{
//Pass the enough information to instanciate the current SharePoint Task
//and the Microsoft.SharePoint.SPListEventType through a web service to Win Workflow
//this way all the workflow process logic is handeled by Win Workflow
//NOTE: need to call through a Web Service as only SPS runs on .Net 1.1 and
//Win Workflow on .Net 2.0
//Get the following information so we can reinstanciate the list item in the workflow
//site url
//list file url
SPWeb spActiveSite = spEvent.Site.OpenWeb();
string spSiteUrl = spActiveSite.Url;
string spFileUrl = spEvent.UrlAfter;
WSToWinWF.Service wsWWF = new Synergy.Procurement.Net1.WSToWinWF.Service();
wsWWF.Credentials = System.Net.CredentialCache.DefaultCredentials;
Boolean wsTestResult = wsWWF.Invoke(spSiteUrl, spFileUrl, System.Convert.ToByte(spEvent.Type));
}
catch (System.Exception e)
{
System.Diagnostics.EventLog.WriteEntry(this.ToString(),e.ToString());
}
finally
{
wic.Undo();
}
}
}
}
Hosting a State Machine in a Web Service
Once the .Net 2.0 Web Service is called its job is to:
- Open the infopath form on the SPS Forms Library and deserialize the InfoPath xml into a serializable class (generated by the xsd utility in .net 2.0)
//Get the infopath file
SPWeb activeSite = new SPSite(spSiteUrl).OpenWeb();
SPFile spFile = activeSite.GetFile(spFileUrl);
//Get the infopath xml from the byte array of the file and read it into a memory //stream
Byte[] byteBuffer = spFile.OpenBinary();
MemoryStream xmlStream = new MemoryStream(byteBuffer);
//Now deserialise the infopath xml into a class
XmlSerializer serializer = new XmlSerializer(typeof(procurementRequest));
procurementRequest _pRequest;
_pRequest = (procurementRequest)serializer.Deserialize(xmlStream);
- Start and stop the workflow runtime and add the ExternalDataExchangeService the in the Global.asax
void Application_Start(object sender, EventArgs e)
{
// NOTE: This requires the configuration section to be named “WorkflowRuntime”.
System.Workflow.Runtime.WorkflowRuntime workflowRuntime = new System.Workflow.Runtime.WorkflowRuntime(“WorkflowRuntime”);
Application[“WorkflowRuntime”] = workflowRuntime;
//Add the procurement service to the runtime
System.Workflow.Activities.ExternalDataExchangeService dataService = workflowRuntime.GetService();
Synergy.Procurement.Net2.LocalServices.ProcurementService procurementService = new Synergy.Procurement.Net2.LocalServices.ProcurementService();
dataService.AddService(procurementService);
//Start the runtime
workflowRuntime.StartRuntime();
}
void Application_End(object sender, EventArgs e)
{
System.Workflow.Runtime.WorkflowRuntime workflowRuntime = Application[“WorkflowRuntime”] as System.Workflow.Runtime.WorkflowRuntime;
workflowRuntime.StopRuntime();
}
- Create a new instance of the state machine or rehydrate an existing instance from SQL Server (I save the WorkFlow instance ID in the InfoPath Document) from the SqlWorkflowPersistenceService
private Guid StartWorkflowInstance()
{
WorkflowRuntime workflowRuntime = (WorkflowRuntime)Application[“WorkflowRuntime”];
//Now get a reference to the ManualWorkflowSchedulerService
_schedulerService = workflowRuntime.GetService();
//Get the current procurement service if haven’t already
if (_procurementService == null)
{
ExternalDataExchangeService dataService = workflowRuntime.GetService();
_procurementService = (ProcurementService)dataService.GetService(typeof(ProcurementService));
}
//Get the instanceid from the infopath document
System.Guid WorkflowInstanceId;
//Start the instance if not started
if (_spListEventType == SPListEventType.Insert)
{
WorkflowInstanceId = Guid.NewGuid();
_workflowInstance = workflowRuntime.CreateWorkflow(typeof(MainStateMachine), null, WorkflowInstanceId);
_workflowInstance.Start();
}
//Load an existing instance
else
{
//Get the instanceid from the infopath document
WorkflowInstanceId = new Guid(_pRequest.referenceNumber);
_workflowInstance = workflowRuntime.GetWorkflow(WorkflowInstanceId);
_workflowInstance.Load();
}
// Now run the workflow. This is necessary when
// …using the ManualWorkflowSchedulerService
_schedulerService.RunWorkflow(WorkflowInstanceId);
return WorkflowInstanceId;
}
- Decide upon which implemented ExternalDataExchange event to raise. This is based on the SPListEventType and the properties in the serializable class representing the InfoPath document (Windows Workflow Foundation ASP.Net State Machine). Create an ExternalDataExchange interface and class with which to call through to event handlers in the StateActivities on your state machine. I pass through the following event arguments:
o WorkFlow instance ID (GUID)
o SPS site URL
o InfoPath file url
o The serializable class representing the InfoPath document
Note:
o You will need to impersonate the current windows identity before accessing the SharePoint site (call the OpenWeb method etc) and the users must have access to SharePoint
WindowsImpersonationContext wic = WindowsIdentity.GetCurrent().Impersonate();
o It is important in your Service class to set the following ExternalDataEventArgs property before raising the event
e.WaitForIdle = true;
o The Win WF Beta2 ManualWorkflowSchedulerService has a bug which may be fixed by calling it’s RunWorkflow method after each time you raise an ExternalDataExchange event in the web service.
The State Machine
It looks like this (simple aye):
The purpose of the state machine is to send emails to various managers requesting approval for procurement, notify procurement requesters of approval or rejection and email office admin staff to assign a PO number. It also updates values on the InfoPath form hosted on the SharePoint site for example the WorkFlow instance ID I talked about earlier. It decides what emails/updates to make based on what events are raised in which particular state. A procurement may need to be approved by several managers up the management chain thus many approval events may be raised (by different managers) once in the ProcurementApproved State Activity.
Below is the code to save back the InfoPath document to the SharePoint site once various updates have been made.
private void SaveInfoPathDoc()
{
//Create an XmlTextWriter to add processing instructions and write the contents out to a memory stream
MemoryStream memoryStream = new MemoryStream();
XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, System.Text.Encoding.UTF8);
//FIX: Add the processing instructions to the top of the xml document this is
//because they are lost in the serialisation\deserialisation process
xmlTextWriter.WriteProcessingInstruction(“mso-infoPathSolution”,
ConfigurationManager.AppSettings.Get(“InfoPathPI_mso-infoPathSolution”));
xmlTextWriter.WriteProcessingInstruction(“mso-application”,
ConfigurationManager.AppSettings.Get(“InfoPathPI_mso-application”));
xmlTextWriter.WriteProcessingInstruction(“mso-infoPath-file-attachment-present”,
ConfigurationManager.AppSettings.Get(“InfoPathPI_mso-infoPath-file-attachment-present”));
//Serialise the xml flush the writer and get the byte array _supportEmail the stream
XmlSerializer serializer = new XmlSerializer(typeof(procurementRequest));
serializer.Serialize(xmlTextWriter, _pRequest);
xmlTextWriter.Flush();
Byte[] byteBuffer = memoryStream.ToArray();
//FIX: Sometimes sharepoint locks the infopath document even though it has been submitted
//in the config file are two appSettings values: RetrySaveInterval & TimesToRetrySave
//which are the retry parameters in case this occurs
int timesToRetrySave = Convert.ToInt32(ConfigurationManager.AppSettings.Get(“TimesToRetrySave”));
//Convert seconds to milli seconds
int retrySaveInterval = Convert.ToInt32(ConfigurationManager.AppSettings.Get(“RetrySaveInterval”)) * 1000;
for (int i = 0; i < timesToRetrySave; i++)
{
try
{
//Get hold of the active site and infopath file
SPWeb activeSite = new SPSite(_pse.SharePointSiteUrl).OpenWeb();
SPFile spFile = activeSite.GetFile(_pse.SharePointFileUrl);
//Overwrite the infopath xml back
spFile.SaveBinary(byteBuffer);
break;
}
catch (Microsoft.SharePoint.SPException ex)
{
//If we’ve run out of retries then write an error to the event log
if (i >= timesToRetrySave – 1)
{
System.Diagnostics.EventLog.WriteEntry(this.ToString(), ex.ToString(), System.Diagnostics.EventLogEntryType.Error);
}
else
{
//Wait for the retry interval
System.Threading.Thread.Sleep(retrySaveInterval);
}
}
catch (Exception ex)
{
System.Diagnostics.EventLog.WriteEntry(this.ToString(), ex.ToString(), System.Diagnostics.EventLogEntryType.Error);
break;
}
}
}
Extras
- Used the External RuleSet Demo to make decisions based on attributes in InfoPath doc instance like BusinessUnit, TotalCost on which manager should receive an email to approve\reject a procurement (I was surprised how easy it was to fit this in).
- InfoPath form access security: I made active directory lookups on email addresses got user logons and updated them in the InfoPath doc which allowed me in InfoPath to ensure only authorised managers/systems administrator’s had access to update approval information in controls on the InfoPath form.
- For debugging I found this invaluable Windows WorkFlow Tracing
by community-syndication | Jul 5, 2006 | BizTalk Community Blogs via Syndication
I’ve been asked a couple times recently about generating message out of BizTalk Server with a dynamically-set file name. Here
are 3 primary ways of setting this value.
In the scenario I built here, it’s a basic “stock order” situation, where the order is received, and an output file is created
with a file name that adheres to a format of <date><ticker symbol>.xml. My “order” schema has a few elements,
and the “ticker symbol” element has been both promoted and distinguished.
Option #1. This is arguable the easiest. Take the message in, create a dynamic send port, and use an Expression Shape
to set the Address of the file drop, including the file name. Here I created a simple date string and appended the distinguished
“symbol” field to build the file name.
As expected, the output file was generated.
Option #2. Let’s say you want the send port pre-configured as a FILE port and don’t want to dynamically set all the values of
the port. Well, what you can do is create a copy of your incoming message (via Message Assignment) and then set the context
value FILE.ReceivedFileName to your dynamically generated name. The FILE.ReceivedFileName is assigned when the FILE
adapter receives a message. It contains the physical name of the inbound file.
This comes into play in the FILE send port where you can use the token %SourceFileName% as the destination file name. That token
uses the FILE.ReceivedFileName value. So what we’ve done is set the value in our orchestration that this token will use when
writing the file out. Once again, after running this version I get the file output with the expected name.
Option #3. Let’s say you have a “messaging-only” solution and no need for orchestration. In that case, you can use a simple
custom pipeline component to do the same thing we did in Option #2. I created a basic custom send pipeline component which sets the
value of the FILE.ReceivedFileName using the code below …
public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
//set friendly date string
string dateString = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString();
//create pointer string
string tickerString = “”;
string fileString = “”;
//get value of ticker symbol that’s been promoted
tickerString = Convert.ToString(inmsg.Context.Read(“Symbol”, “http://Microsoft.Blog.DynamicOutput.PropSchema”));
//build outbound file name
fileString = dateString + tickerString + “.xml”;
//write updated value back to context
inmsg.Context.Write(“ReceivedFileName”, “http://schemas.microsoft.com/BizTalk/2003/file-properties”, fileString);
//return the message with modified context
return inmsg;
}
Once that component is compiled and made available to Visual Studio, you create a Send Pipeline and drop our little component in there,
like so …
And I get the same file name as the other two options. So, it’s fairly easy to manipulate the destination file name using either
dynamic ports or playing with context values. Any other options I missed?
Technorati Tags: BizTalk