Process XML Documents over HTTP Inbound Channel with Workflows

Introduction

This article explains about 

  • processing XML document Types received on HTTP Inbound Channel from a Partner on webMethods.io B2B.
  • Process the Messages using workflows on webMethods.io Integration.

Use Case

Below diagram represents the use case explained in this article. This article uses the Identifiers User Defined 1 for identifying the Enterprise and Partner Profiles.

  • ABCCorporation is a partner of ACMEOrganization. 
  • ABCCorporation would like send Purchase Order to ACMEOrganization.
  • ACMEOrganization is using webMethods.io (B2B, Integration) for receiving and processing the Purchase Order.
  • ABCCorporation is configured as partner profile and ACMEOrganization is configured as Enterprise on webMethods.io B2B.
  • ABCCorporation is identified as ABC and ACMEOrganization is identified as “User Defined 1” over HTTP channel.
  • Below is the purchase order XML sample.

<?xml version="1.0"?>
<PurchaseOrder PurchaseOrderNumber="1" OrderDate="2020/04/22">
<Metadata>
<Sender>ABC</Sender>
<Receiver>ACME</Receiver>
</Metadata>
<Address Type="shipping">
<Name>ABC Corporation</Name>
<Street>ABC Street</Street>
<City>ABC City</City>
<State>ABC State</State>
<Zip>560037</Zip>
<Country>ABC</Country>
</Address>
<DeliveryNotes>Office</DeliveryNotes>
<Items>
<Item PartNumber="1">
<ProductName>ACME</ProductName>
<Quantity>10</Quantity>
<USPrice>1000</USPrice>
<Comment>ACME</Comment>
<ShipDate>2020/04/22</ShipDate>
</Item>
</Items>
</PurchaseOrder>

Implemenation Steps

Below diagram represents the configurations required for on webMethods.io B2B and Integration.

  • webMethods.io B2B is should be configured with enterprise with User Defined 1 identifier as ACME and partner profile (ABC) should be created with User Defined 1 identifier as ABC.
  • An inbound HTTP channel should be associated the Partner Profile to receive XML messages.
  • Partner user should be created and associated with the partner profile to send Order XML.

Create Document from XML Sample on webMethods.io Integration

  • webMethods.io B2B can import the documents from webMethods.io Integration. Login to webMethods.io Integration -> Navigate to Project -> Configurations -> Pick Flow service -> Document Types -> Click on Add Document Type.

  • Create the document with the name purchaseOrder using the example from Use case section

Import the document to webMethods.io B2B

  • Login to webMethods.io Integration -> Navigate to Project -> Configurations -> Pick Flow service -> Document Types -> Click on Add Document Type.• Login to webMethods.io B2B - > Navigate to Documents -> Business Documents -> Add Document -> XML -> Provide Name as purchaseOrder -> Select Project Name where you created the XML document in the above step

  • Navigate to imported document and click on activate; configure the sender, receive identifiers. This can be configured from Attributes section of the document. Select the source field and add to identifiers. In this use case, Metadata fields in the sample represents the sender and receiver identifiers

Processing Rule for XML Document on webMethods.io B2B

  • Navigate to Processing Rules, create a Processing rule in the required order (Above/first/last) by selecting the existing processing rules. Processing rule criteria should be selected as
    • Sender -> Partner (ABCCorportation)
    • Receiver -> Enterprise
    • li>Document -> Purchase Order.

  • Select the action to send to a workflow on webMethods.io Integration. Do note that workflow is exposed as an API in this example.

  • Use “ export-fla17bba0b146ca107fdc9c1-1588150572491.zip” from the attachments if you are using flow editor as an example integration on webMethods.io Integration

How to Process B2B Messages on Workflows

  • Below diagram represents the high level overview for the workflow to process the messages from webMethods.io B2B.

  • In this use case, the workflow just logs the messages received from webMethods.io B2B but the same message can be subjected all the VETO (Validate, Enrich, Transform, Operate) patterns.
  • webMethods.io B2B sends the payload for the processing actions in the below format.

{
  "metadata": {
      "sender": "ABC",
      "receiver": "ACME",
      "documentType": "WorkOrder",
      "documentId": "0ah9gs00e6td1odr00000250",
      "userStatus": null,
      "groupId": null,
      "conversationID": null,
     "attributes": null
},
"request": {
     "content":      "PD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8V29ya09yZGVyIFdvcmtPcmRlck51bWJlcj0iMSIgT3Jk\r\nZXJEYXRlPSIyMDIwLzA0LzIyIj4NCiAgICA8TWV0YWRhdGE+DQogICAgICAgIDxTZW5kZXI+Tk9M\r\nQU48L1NlbmRlcj4NCiAgICAgICAgPFJlY2VpdmVyPlRPUkNIWVRBQ09TPC9SZWNlaXZlcj4NCgkJ\r\nPEZpbGVMb2NhdGlvbj5pbmNvbWluZy9uZXcvdGV4dC54bWw8L0ZpbGVMb2NhdGlvbj4NCiAgICA8\r\nL01ldGFkYXRhPg0KPC9Xb3JrT3JkZXI+",
     "type": "1",
      "encoding": "UTF8"
   }
}

Parent Object Name

Child field Name

Description

metadata

Meta data from webMethods.io B2B. This contains the message identification details

sender

Message Sender details. In this case Partner details

receiver

Message receiver details. In this case Enterprise details

documentType

Document name on webMethods.io B2B

documentId

Document unique identifier on webMethods.io B2B

userStatus

User status of the transaction

groupId

Document group

conversationID

Conversation Identifier of the transaction

attributes

Document custom attributes defined (if any)

request

Actual Raw Message Payload received from Partner over the inbound channel

content

Base64 encoded content of the actual transaction

type

webMethods.io B2B internal content type

encoding

Message coding

  • Define the webhook payload for the workflow with the above sample.

  • webMethods.io Integration offers transformers, and using base64decode the content from webMethods.io B2B can be transformed to original format.

  • With this step the message received from webMethods.io B2B would be available for workflow to process as required. In this example, the message just logged and a response is acknowledged back.

Send XML Message over HTTP from Postman

  • Testing from Postman requires below features to be turned-off on the channel.

  • Use the postman collection - https://www.getpostman.com/collections/186b1096086f600b39d8 to post the XML over HTTP inbound channel. You need to configure the below on postman before posting.
    • tenantname - > webMethods.io B2B Tenant Name
    • channelid -> Channel Unique identifier
    • Authorization -> Partner User