Authenticating senders and recievers in BizTalk

Once more back into the EDI/BizTalk breach.

While testing an BizTalk EDI-document orchestration that I created, I ran into a couple of problem.  Specifically, an EDI document was rejected because BizTalk was unable to authorize the sender and receiver.  The specific error message (as found in the Event Log) was “The recipient of the document is not recognized” or “The sender of the document is not recognized“. The documentation on exactly what is being done here is sparse, so let me describe what BizTalk is looking for.  To start with, consider the following fist couple of lines in the EDI document.  These lines are before the transactions contained within the document and are used by EDI subsystem authenticate and route the document.

ISA*00*          *00*          *ZZ*CONTOSO        *12*4162164603     *050328*0852*U*00401*000004393*0*P*>

When an EDI document is received through the pipeline, the subsystem opens the document to find the send.  In the above code, the sender is indicated by the 'ZZ' and 'CONTOSO' blocks in the first line.  As well, the sender id is found in the third field ('9055551212') in the second like.  These data are combined to form a party identifier. The party identifier looks like EDI://CONTOSO:ZZ:9055551212. Once the identifier is created, the EDI Subsystem examines the list of Parties to find the sender.  If not found, then an entry is put into the event log saying that the sender could not be authenticated.

The second part of the authentication process is to authenticate the receiver. The identifier for the receiver is constructed in a similar manner.  For the above example, the recipient party identifier is EDI://4162164603:12:5198581234.  The information used to create this come from the first line (segments 6 and 7) and  the second line (segment 4).  Not only does the EDI Subsystem look for the sender party identifier in the Parties list, but also the recipient party identifier.

What this means is that in order for the EDI Subsystem to accept an EDI document, both the sender and recipient need to be defined as a Party.  To do this, open up the BizTalk Explorer, expand the view to reveal the Parties node.  Right click on Parties and select Add Party. In the dialog box that appears, give a reasonable name for the party.  In the Properties list that appears, add a property called EDI, with a Qualifier of EDI and a Value of the sending party identifier (for our example, EDI://CONTOSO:ZZ:9055551212).  Save this new party.  Make sure that a second party is created using the receiving party identifier.  With this combination of parties, the incoming EDI documents can be correctly authenticated and fed in to the processing pipeline.