Search code examples
biztalkbiztalk-2020

BizTalk 2020 - Receiving JSON decoded REST messages for different schemas


I've got 2 sets of schemas (send and receive); CheckUserExists and SaveBusinessObject.

Both schemas are used to send and receive payloads to and from JSON REST endpoints. In the orchestration, these ports are under the same port group. In the console, that port group uses custom JSON pipelines for both the inbound and the outbound messages.

The problem is with the receive pipeline; because I am receiving 2 different schemas, the receive pipeline config requires a specific targetnamespace and root, which doesn't match the second schema.

The only way I can think of doing this is to have seperate send-receive ports; one for the CheckUserExists and one for the SaveBusinessObject, so that they can both have their own JSON decoder pipeline properties defined.

Is that the best way, or is there a better way of achieving this?

Orchestration - shows the two calls being made to send and receive the JSON payloads, where GetSearchResponse uses one sets of schemas and SaveBusinessObject uses another Console - shows the JSON decoders receive pipeline and how it's configured against the first schema only


Solution

  • Yes, having separate send and receive ports would be easiest to achieve just using the out of the box BizTalk functionality.

    However if you do want to have a single send and receive port that can handle multiple schemas, you could use a custom pipeline component called the BRE Pipeline Component, and BRE rules that inspect the JSON payload and execute a rule that would call the JSON decoder with the correct namespace. See BRE Pipeline Framework Here is an example of the sort of rule in BRE Example of BRE Rule

    The other option would be to create a single schema that handles both response payloads (but same root and namespace) and then map from there to your desired schema and namespace in your Orchestration.