I'm using an asp.net 6 application and using SoapCore.
To get the headers in my service, I created a custom inspector with IMessageInspector2 and pass the headers to my service.
Now, I have all headers in my service but can not read the values.
How can I read the value?
public class MessageFilter : IMessageInspector2
{
public MessageFilter (IHttpContextAccessor acc, ILogger<MessageFilter> logger, IMyService myService)
{
_acc = acc;
_logger = logger;
_myService = myService;
}
public object AfterReceiveRequest(ref Message message, ServiceDescription serviceDescription)
{
_myService.SetHeaders(message.Headers);
return null;
}
...
}
Finally in my service when I want to read the value there is an xml tag like:
<htng:CorrelationID>[guid]</htng:CorrelationID>
The value is xml but I need the value:
var value = _messageHeaders[1].ToString();
How can I deserialize it to a model? or get the Guid as value?