Skip to content

Commit

Permalink
fix: Resolve IMessageInspector2 Using Scope Resolver
Browse files Browse the repository at this point in the history
----IMessageInsector2 is being Added as Scope Service, However, it is being resolve as Sington Service
  • Loading branch information
ankitkmrpatel committed Dec 13, 2023
1 parent c419020 commit 58afbb9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/SoapCore/SoapEndpointMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,15 @@ private async Task<Message> ProcessMessage(Message requestMessage, SoapMessageEn
throw new ArgumentException($"Unable to handle request without a valid action parameter. Please supply a valid soap action.");
}

var messageInspector2s = serviceProvider.GetServices<IMessageInspector2>();
var correlationObjects2 = default(List<(IMessageInspector2 inspector, object correlationObject)>);

correlationObjects2 = messageInspector2s.Select(mi => (inspector: mi, correlationObject: mi.AfterReceiveRequest(ref requestMessage, _service))).ToList();
using (IServiceScope scope = serviceProvider.CreateScope())
{
var messageInspector2s = scope.ServiceProvider.GetServices<IMessageInspector2>();
correlationObjects2 = messageInspector2s.Select(mi =>
(inspector: mi, correlationObject: mi.AfterReceiveRequest(ref requestMessage, _service)))
.ToList();
}

// for getting soapaction and parameters in (optional) body
// GetReaderAtBodyContents must not be called twice in one request
Expand Down

0 comments on commit 58afbb9

Please sign in to comment.