Skip to content

Develop a mechanism to process responses returned by Business Gateway

Messages returned by Business Gateway can be either synchronous or asynchronous. Synchronous responses are returned immediately after the request is sent, whereas asynchronous responses are returned at a later time and must be polled for. All responces follow the same structure, as defined in the WSDL. here is an exampleof the structure of a typical response:

Response Structure

As you can see from the above diagram, all responses follow the same pattern, and only differ at the Message Details level. To process these responses.

As you can see from my POC, I elected to use AutoMapper to map the response objects to my internal domain objects. This made it easier to work with the data returned by Business Gateway. This may not be the best approach for your implementation, but it is one way to handle the response processing. After passing my logic through GitHub Copilot, it did make some improvements, such as better null checking and some optimizations, but overall it didnt change my code significantly.

The issue with this approach is that it leans very hard on the naming schema generated by SvcUtil when it converts the WSDL to C# classes. If HM Land Registry change the WSDL, then it is likely that my mapping logic will break, and the mapping will need to update it accordingly. This is because the service interface contains many constructs that are the same, such as TextTypes, and the SvcUtil doesnt know the difference so just create Q1TextType, Q2TextType etc. This means that if the WSDL changes, then the mapping logic will need to be updated to reflect the new naming schema.