Export (0) Print
Expand All

Creating a Solution

In this scenario, you are receiving a ProcessPurchaseOrder BOD from a partner. The incoming message is received from a file location and passed into the BizTalk messaging engine, which activates a new orchestration to process this message. The orchestration will inspect the value of the ConfirmationCode element to determine the circumstances in which a ConfirmBOD message should be sent. A map will be used to generate an AcknowledgePurchaseOrder and ConfirmBOD (if needed,) message. The orchestration will then send the message(s) to the trade partner, using the value of the LogicalID node as the address of the send port.

The following sections guide you through implementing this scenario as a BizTalk solution.

Prerequisites

The following components must be available before attempting this scenario:

ComponentPurpose

c:\temp\in

File location of the incoming ProcessPurchaseOrder document.

c:\temp\out

File location that the outbound AcknolwedgePurchaseOrder and ConfirmBOD documents will be created in.

Components_Schemas.dll

Assembly containing Component schemas required for Nouns.

Noun_Schemas.dll

Assembly containing the BOD and PurchaseOrder Nouns.

BOD_Schemas.dll

Assembly containing AcknowledgePurchaseOrder, ConfirmBOD and ProcessPurchaseOrder BOD schemas.

Step 1: Create the Maps

The AcknolwedgePurchaseOrder and ConfirmBOD documents will be generated by applying a map to the ProcessPurchaseOrder document. The map will copy elements of the ProcessPurchaseOrder message into the response messages so that the originating system will be able to match the response documents to the original ProcessPurchaseOrder request.

To create the AcknowledgePurchaseOrder map
  1. In Visual Studio 2005, create a new BizTalk project named “Maps.” This will contain the BizTalk maps used to create the AcknowledgePurchaseOrder and ConfirmBOD messages.

  2. In Solution Explorer, right-click the project name, and select Add Reference. On the Browse tab, select the Components_Schemsa.dll, Noun_Schemas.dll and Bod_Schemas.dll assemblies, and then click OK. These references will allow the maps to access the BOD schemas.

  3. Right-click the project name and select Properties. On the Project Property Pages, expand the Common Properties entry, select Assembly, and then select the Assembly Key File entry in the right pane. Click the ellipsis (…) button, and then select the OAGIS.snk file created previously. Click OK.

  4. Right-click the project name, select Add, and then select New Item. On the Add New Item dialog box, select Map files in the Categories pane, then select Map in the Templates pane. Enter “POToAck.btm” in the Name field, and then click OK.

  5. Click Open Source Schema. In the BizTalk Type Picker section, expand Maps, expand References, and expand the reference containing the BOD schemas.

    Expand Schemas, and then select the ProcessPurchaseOrder schema. Click OK.

    Repeat this step to select AcknowledgePurchaseOrder as the Destination Schema.

    Select the schemas to use in a map

  6. From the Toolbox, drag the following items to the grid between the two schemas:

    • String Concatenate
    • Date and Time
    • Scripting
    • Mass Copy (add this item twice)
  7. Set the following parameters for the String Concatenate and Scripting Functoids:

    String Concatenate

    1. Select the String Concatenate item from the grid. In Properties, select Input Parameters, and then click the ellipsis (…) button.
    2. Click the Insert New Parameter button and enter the value “9.2” for the new parameter. Click OK.
      Dd277891.note(en-US,BTS.10).gifNote
      This value will be used to populate the releaseID value of the outbound document and should be adjusted to match the OAGIS release version that you are using.

      Configure the String Concatenate functoid

    Scripting Functoid

    1. Select the Scripting item from the grid. In Properties, select Script, and then click the ellipsis (…) button.
    2. Select Inline C# from the Script type drop-down list, enter the following in the Inline Script Buffer, and then click OK.
      This code will return a new GUID value that will be used to populate the BODID element of the outbound document.
      public string GetGuid()
      {
         return System.Guid.NewGuid().ToString();
      }
      

      Configure the scripting functoid

  8. Link the following items by dragging lines between them:

    Source schema nodeFunctoidDestination schema node

    No incoming link

    String Concatenate

    AcknowledgePurchaseOrder\releaseID

    No incoming link

    Date and Time

    AcknowledgePurchaseOrder\<Sequence>\ApplicationArea\CreationDateTime

    No incoming link

    Scripting

    AcknowledgePurchaseOrder\<Sequence>\ApplicationArea\BODID

    ProcessPurchaseOrder\<Sequence>\ApplicationArea

    Mass Copy

    AcknowledgePurchaseOrder\<Sequence>\DataArea\Acknowledge
    \<Sequence>\OriginalApplicationArea

    ProcessPurchaseOrder\<Sequence>\DataArea\PurchaseOrder

    Mass Copy

    AcknowledgePurchaseOrder\<Sequence>\DataArea\PurchaseOrder

    Map links

  9. In Solution Explorer, right-click the project name and select Build.

  10. After the build has completed, right-click the project name and select Deploy.

To create the ConfirmBOD map
  1. In Visual Studio 2005, open the BizTalk project containing the AcknowledgePurchaseOrder map.

  2. Right-click the project name, select Add, and then select New Item. On the Add New Item dialog box, select Map files in the Categories pane, and then select Map in the Templates pane. Enter “POToConfirm.btm” in the Name field, and then click OK.

  3. Click Open Source Schema. In the BizTalk Type Picker, expand Maps, expand References, and then expand the reference containing the BOD schemas.

    Expand Schemas, select the ProcessPurchaseOrder schema, and then click OK.

    Repeat this step to select ConfirmBOD as the Destination Schema.

  4. From the Toolbox, drag the following items to the grid between the two schemas:

    Concatenate

    • String Concatenate
    • Date and Time
    • Scripting
    • Mass Copy (add this item twice)
  5. Set the following parameters for the String Concatenate and Scripting Functoids:

    String Concatenate

    1. Select the String Concatenate item from the grid. In Properties, select Input Parameters and click the ellipsis (…) button.
    2. Click the Insert New Parameter button and enter the value “9.2” for the new parameter. Click OK.
      Dd277891.note(en-US,BTS.10).gifNote
      This value will be used to populate the releaseID value of the outbound document and should be adjusted to match the OAGIS release version that you are using.

    Scripting Functoid

    1. Select the Scripting item from the grid. In Properties, select Script, and then click the ellipsis (…) button.
    2. Select Inline C# from the Script type drop-down list, enter the following in the Inline Script Buffer, and then click OK.
      This code will return a new GUID value that will be used to populate the BODID element of the outbound document.
      public string GetGuid()
      {
         return System.Guid.NewGuid().ToString();
      }
      
  6. Link the following items by dragging lines between them:

    Source schema nodeFunctoidDestination schema node

    No incoming link

    String Concatenate

    ConfirmBOD\releaseID

    No incoming link

    Date and Time

    ConfirmBOD\<Sequence>\ApplicationArea\CreationDateTime

    No incoming link

    Scripting

    ConfirmBOD\<Sequence>\ApplicationArea\BODID

    ProcessPurchaseOrder\<Sequence>\ApplicationArea

    Mass Copy

    ConfirmBOD\<Sequence>\DataArea\Confirm
    \<Sequence>\OriginalApplicationArea

    ProcessPurchaseOrder\<Sequence>\DataArea\PurchaseOrder
    \PurchaseOrderHeader\<Sequence>\<Group:DocumentIDsGroup>
    \DocumentID\<Equivalent>\<DocumentIDType>\<Sequenece>\ID

    Mass Copy

    Confirm\<Sequence>\DataArea\BOD\BODSuccessMessage
    \NounSuccessMessage\ProcessMessage\ID

  7. In Solution Explorer, right-click the project name and select Build.

  8. After the build has completed, right-click the project name and select Deploy.

Step 2: Create the Orchestration

Orchestrations typically contain processing logic, such as what action to take if a document contains a certain value. In this scenario, we will inspect the value of ConfirmationCode on the ProcessPurchaseOrder request, and if set to “Always,” return a ConfirmBOD. The process of constructing the ConfirmBOD, as well as the AcknowledgePurchaseOrder documents, will be handled by maps located in send ports.

To create the orchestration
  1. In Visual Studio 2005, create a new BizTalk project to contain the orchestration.

  2. In Solution Explorer, right-click the project name and select Add Reference. On the Browse tab, select the assemblies containing the BOD, Noun and Component schemas, and then click OK.

  3. Right-click the project name and select properties. In the Project Property Pages, expand the Common Properties entry, select Assembly, and then select the Assembly Key File entry in the right pane. Click the ellipsis (…) button and select the OAGIS.snk file created previously.

  4. Right-click the project name, select Add, and then select New Item. On the Add New Item dialog box, select Orchestration files in the Categories pane, then select BizTalk Orchestration in the Templates pane. Enter “ProcessPO.odx” in the Name field, and then click OK.

  5. Right-click Port Surface, and select New Configured Port. Click Next and enter Receive_Port in the Name field. Continue through the wizard, selecting Next to accept the default values, and then click Finish.

  6. Configure the Send_Ack_Port and Send_Confirm_Port:

    1. Right-click the Port Surface and select New Configured Port. Click Next and enter “Send_Ack_Port” in the Name field. Click Next.
    2. Accept the defaults on the Select a Port Type page by clicking Next. On the Port Binding page, set the Port direction of communication field to I’ll always be sending messages on this port, and then set the Port Binding to Dynamic.
    3. Set the Send pipeline field to Microsoft.BizTalk.DefaultPipelines.XMLTransmit, and then click Next. Click Finish.

    Repeat this step to create the Send_Confirm_Port.

  7. In Orchestration View, right-click Messages, and then select New Message. In Properties, enter “PO_In” in the Identifier field. From the Message Type drop-down list, expand Schemas, and then click <Select from reference>.

  8. On the Select Artifact Type dialog box, expand the reference containing the BOD schemas, and select the ProcessPurchaseOrder schema. Click OK.

    Select schema from reference

  9. Add and configure the following action shapes to design the orchestration flow:

    ProcessPurchaseOrder Receive

    • From the Toolbox, drag the Receive shape to the design surface and drop it on the Drop a shape from the toolbox here text. In Properties, enter “Receive_PO” in the Name field and select PO_In as the value of the Message field. Set the value of the Activate field to True to indicate that messages received in this shape should create a new instance of the orchestration.

    Confirmation Decision

    1. From the Toolbox, drag the Decide shape to the design surface and place it immediately below the Receive_PO shape. In Properties, set the Name of the Decide shape to “Send_Confirm.”
    2. Select the Rule_1 branch of the decide shape, and in Properties, set the Name field to Always. Select the Expression field and click the ellipsis (…) button.
    3. In the BizTalk Expression Editor, enter the following code, and then click OK:
      PO_In(BOD_Schemas.PropertySchema.ConfirmationCode)=="Always"
      
      If the Confirmation Code of the incoming message contains the value “Always,” then this branch of the Decide shape will be processed.

    ConfirmBOD Send

    1. Add an Expression shape immediately after the Always shape in the Send_Confirm decision. In Properties, enter Set_Confirm_Address in the Name field. Select the Expression field, and then click the ellipsis (…) button.
    2. In the BizTalk Expression Editor, enter the following:
      Send_Confirm_Port(Microsoft.XLANGs.BaseTypes.Address)=PO_In(BOD_Schemas.PropertySchema.LogicalID)+”Confirm.xml”;
      
      This will set the Send_Confirm port to the address contained in the LogicalID field of the incoming message, and a message name of Confirm.xml. This will be the URI used to send the message returned over this port.
    3. From the Toolbox, drag the Send shape to the design surface and place it immediately after the Set_Confirm_Address, inside the Send_Confirm Decide shape. This will be used to send the ConfirmBOD message if the Always rule is triggered. In Properties, set the Name of the Send shape to Send_Confirm. Set the Message to PO_In.
      Dd277891.note(en-US,BTS.10).gifNote
      The physical send port that will be attached to this send shape will apply a map that will create the ConfirmBOD to be sent back to your partner.

    AcknowledgePurchaseOrder Send

    1. Add an Expression shape immediately after the Send_Confirm decision shape. In Properties, set the Name field to Set_Ack_Address, select the Expression field, and then click the ellipsis (…) button.
    2. In the BizTalk Expression Editor, enter the following code:
      Send_ACK_Port(Microsoft.XLANGs.BaseTypes.Address)=PO_In(BOD_Schemas.PropertySchema.LogicalID)+”Ack.xml”;
      
      This will set the Send_Confirm port to the address contained in the LogicalID field of the incoming message, with a message name of Ack.xml. This will be the URI used to send the message returned over this port.
    3. From the Toolbox, drag the Send shape to the design surface and place it immediately after the Send_Confirm design shape. This should place it immediately above the red stop symbol. In Properties, set the Name to “Send_Ack” and set the Message to “PO_In.” This port will send the AcknowledgePurchaseOrder message to your trade partner.
      Dd277891.note(en-US,BTS.10).gifNote
      The physical send port that will be attached to this Send shape will apply a map that will create the ConfirmBOD to be sent back to your partner.

  10. To link the Send and Receive shapes to the logical ports, drag the green direction indicator of the port shapes to the Send and Receive shapes:

    Drag thisTo this

    Receive_Port

    Receive_PO

    Send_Ack_Port

    Send_Ack

    Send_Confirm_Port

    Send_Confirm

    Completed Orchestration

  11. In Solution Explorer, right-click the project name and select Build.

  12. After the build has completed, right-click the project name and select Deploy.

Step 3: Create the Messaging Ports

The logical ports in the orchestration will be connected to physical messaging ports. In the following steps you will use the BizTalk Administration Console to create and configure the following ports:

Port NamePurpose

Receive_PO

Receives the ProcessPurchaseOrder request.

Send_ACK

Sends the AcknowledgePurchaseOrder response.

Send_Confirm

Sends the ConfirmBOD, if requested by the ProcessPurchaseOrder request.

Dd277891.note(en-US,BTS.10).gifNote
Before starting the ports, verify that the physical send and receive locations exist.

To create the Receive_PO port
  1. From the Start menu, point to All Programs, point to Microsoft BizTalk Server 2006, and then select BizTalk Server Administration.

  2. In the Console Root pane of the BizTalk Server 2006 Administration Console, expand BizTalk 2006 Server Administration, expand BizTalk Group, expand Applications, expand BizTalk Application 1, and then select Receive Ports.

  3. Right-click Receive Ports, select New, and then select One-way Receive Port.

  4. In the Receive Port Properties dialog box, enter “Receive_PO” in the Name field, and then click OK.

  5. In the Console Root tree, right-click the Receive Locations entry. Select New, and then select One-way Receive Location. In the Select a Receive Port dialog box, select Receive_PO, and then click OK.

  6. In the Receive Location Properties dialog box, enter “Receive_PO_Location” in the Name field.

  7. Select File from the Type drop-down list, and then click Configure.

  8. In the File Transport Properties dialog box, enter the file location to receive the ProcessPurchaseOrder file from, such as c:\temp\input, and then click OK.

  9. In the Receive Pipeline field, select XMLReceive, and then click OK.

    Receive_PO_Location configuration

  10. Right-click Receive_PO_Location, and then select Enable.

To configure the Send ports
  1. In the BizTalk Server 2006 Administration Console, expand BizTalk Server 2006 Administration, expand BizTalk Group, expand Applications, and finally expand BizTalk Application1.

  2. Select Send Ports. Note that two send ports were created when the orchestration was deployed. These correspond to the Send_Confirm_Port and Send_Ack_Port within the orchestration. The port name will be a composite of the project name, port name and the public key token the assembly was signed with.

  3. Right-click the send port containing “Send_Confirm_Port” as part of the name, and then select Properties.

  4. In the left pane, select Outbound Maps. In the Outbound Maps pane, select POToConfirm in the Map column of Outbound Maps. The Source Document and Target Document fields should automatically populate with ProcessPurchaseOrder and ConfirmBOD. Click OK.

    Configuring maps in the outbound port

  5. Right-click the send port containing “Send_Ack_Port” as part of the name, and then select Properties.

  6. In the left pane, select Outbound Maps. In the Outbound Maps pane, select POToAck in the Map column of Outbound Maps. The Source Document and Target Document fields should automatically populate with ProcessPurchaseOrder and AcknowledgePurchaseOrder. Click OK.

  7. Right-click each send port and select Start.

To link the orchestration to the send ports
  1. In the BizTalk Server 2006 Administration Console, expand BizTalk Server 2006 Administration, expand BizTalk Group,expand Applications, and finally expand BizTalk Application 1.

  2. Right-click the Orchestrations folder, and then select Properties on the orchestration.

  3. Select Bindings, and then select BizTalkServerApplication in the host field.

  4. In the Bindings section, select Receive_PO in the Receive Ports field to associate the logical Receive_Port in the orchestration with the Receive_PO message port. Note that the Outbound Logical Ports are already selected. Click OK.

    Orchestration Bindings

  5. Right-click the orchestration, and then select Start.

At this point the orchestration and ports should be enabled, and ready to process incoming messages. BizTalk Server will pick up incoming documents from c:\temp\in, process them, and send the AcknowledgePurchaseOrder, and optionally ConfirmBOD documents. The value of the LogicalId field will be used as the output path for the response documents. In this scenario it should contain the value “file://c:\temp\out\”.

Show:
© 2014 Microsoft