Join wMUsers | Blog at wMUsers | User Control Panel | Site Map | webMethods Jobs |For Employers

Phillip Leary -- webMethods Ezine Columnist

Adding Dynamic Processing Logic to Trading Networks



By Phillip Leary

 

Another approach to consider is defining processing rules that filter on the partner identifier (sender ID attribute) within the document. While hiding the private details from the sender, this approach still has problems at both the technical and business level.

We would need a unique processing rule for each category of partner and a static list of the partners in that category. With our partners moving up and down the categories based on expenditures, this static list will not exist.

We need an approach allowing TN to receive a purchase order from any partner, select a single document type, execute a single processing rule, select the category of the partner from a dynamically maintained database table, and then reprocess the document -- without requiring any changes to the document and all within the same TN transaction.


Dynamic Processing Solution

If we combine pieces of the two undesirable approaches, we can create one approach that minimizes our short-term and long-term effort (so we will use very few document types and processing rules) as well as allowing for dynamic partner categories and hiding those category details from our partners.

Remembering our sequence of events for document processing, we know that TN will identify incoming documents based on criteria established in our document types, and then extract the document attributes once identification has been made. In our scenario, we will use one document type to identify ALL purchase orders.

The selection criteria will include a DOCTYPE identifier and a root tag of purchaseOrder, as these are the identifying pieces of our standard purchase order document. We will extract attributes SenderID, ReceiverID, DocumentID, and UserStatus. We know that as soon as TN has extracted the document attributes, it will then start looking for a processing rule. We will have four processing rules:

  1. VitalPartnerRule: Any Sender, Any Receiver, Document Type="purchaseOrder", User Status="Vital". Our processing actions will trigger an Integration Server service called "processVitalPO".

  2. StrategicPartnerRule: Any Sender, Any Receiver, Document Type="purchaseOrder", User Status="Strategic". Our processing actions will trigger an Integration Server service called "processStrategicPO".

  3. OtherPartnerRule: Any Sender, Any Receiver, Document Type="purchaseOrder", User Status="Other". Our processing actions will trigger an Integration Server service called "processOtherPO".

  4. AllPurchaseOrderRule: Any Senders, Any Receivers, Document Type="purchaseOrder", User Status="Any User Status". Pre-processing actions will save our document to the TN database. Our processing actions will trigger an Integration Server service called "processAllInitialPO".

An important thing to remember about processing rules is the order in which they appear in the TN console is the order in which they are evaluated. As soon as any one processing rule criteria matches the current document and process, that rule is selected and all others are ignored.

This means for our scenario solution to work, we have to place the processing rules in the correct order, as shown above. Otherwise, there exists the potential for AllPurchaseOrderRule to be selected in all cases (as it does not care about the User Status).

As you have probably surmised, the key to our solution is the service called by the AllPurchaseOrderRule. This is a standard Integration Server service, utilizing the input/output specification for processing services (wm.tn.rec:ProcessingService).

This specification allows the service to receive the business document (inside of a bizdoc envelope), the extracted document attributes, and anything else in wm.tn:receive pipeline for this document. Our service performs three steps:

  1. The service pulls out the SenderID value from the incoming data, and places a query to a database table containing our partners and their current categories (something along the lines of "select CATEGORY from PartnerCategory where PARTNERID = ‘%bizdoc/SenderID%’").
  2. When the current partner category has been retrieved, our service maps the category value to the UserStatus field of the bizdoc record structure (bizdoc/UserStatus).
  3. The service then resubmits the business document using wm.tn:submit, mapping the newly modified bizdoc record structure to the bizdoc node of wm.tn:submit.

Once the document is resubmitted, the VitalPartnerRule, StrategicPartnerRule, or OtherPartnerRule will trigger based on the new value of the User Status field. Each of these rules triggers appropriate actions or services specific to the category of partner.

We can then dynamically change the processing behavior for inbound Purchase Order documents by altering only one thing: the PartnerCategory table.


Summary

Our solution has achieved dynamic business logic routing, without requiring our partners to make changes to their business documents or processes, and while leveraging the routing and filtering capability of Trading Networks. Of course, this is a generic design solution, intended to show the possible benefit of using User Status to resolve dynamic processing challenges.

User Status can be used in a similar way to create dynamic processing solutions to meet your technical and business needs.


One Last Detail

When I implemented this solution for my customer, I ran into one unexpected problem in the way Trading Networks stores SenderID and ReceiverID in the TN database. While our document attributes for SenderID and ReceiverID may extract the company name, DUNS ID, or some other external unique identifier, Trading Networks resolves SenderID and ReceiverID back to the unique profile ID created by TN when the profile was saved.

For example, a company called ACME with a DUNS ID of 3167890 may have a TN unique profile ID of 7f000001f70df1ff00000066 in the partner database. It is the TN unique profile ID that is sent as part of the bizdoc, not the extracted attribute value.

This means a lookup database table such as our PartnerCategory table should either contain the TN unique profile ID for the trading partner, or the processing service should resolve this ID back to the extracted attribute value (using a service such as wm.tn.profile:getExternalID.



<<Prev  1  2  [3]  

Go Deeper on the Subject: The wMUsers Discussion Forums


Phillip Leary is a co-founder of Crossvale, an educational services firm specializing in integration issues. In the five years prior to co-founding Crossvale, Phillip held a variety of consultancy, management, and business development positions at Deloitte Consulting and Price Waterhouse. He has provided consulting and training services on the webMethods platform since 1998.

Phillip can be reached via email at


Advertise at wMUsers






  Home | Join wMUsers | Discussion Forums | Knowledge Center | Jobs | Shareware | User Groups | Links |
Contact Us | Terms of Service | Privacy Policy

wMUsers is an independent organization and is not sponsored in any manner by Software AG.


© All Rights Reserved, 2001-2008.