.NET Core Request REST MessageInspector

170 Views Asked by At

I have a backend application in .NET Core 6 that makes calls to different external services. Until now it was all SOAP calls.

I used a class that inherited from IEndpointBehavior and this in turn used a class of its own that inherited from IClientMessageInspector.

This way I could access from any place of my code to the calls that were made from my application to outside, and I had a common place to make operations with them.

Now I want to do the same but with REST calls, and I can't find the way to do it.

Apparently IEndpointBehavior cannot be used with REST calls.

Could you tell me how to adapt the code?

Thanks

Edit: Here you can see an example: https://learn.microsoft.com/es-es/dotnet/api/system.servicemodel.dispatcher.iclientmessageinspector.beforesendrequest?view=dotnet-plat-ext-7.0

Something similar to this is what I have for SOAP.

So I can inspect / modify the response and request of my SOAP calls. This piece of code is COMMON for any call I make from all my application.

The idea is to do something similar for REST calls.

0

There are 0 best solutions below