You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why not just use the attributes attached to the class? It seems redundant.
[XmlRoot("MeowHeader", Namespace= "http://meow.com/")]
public class MeowResponseHeader : SimpleSOAPClient.Models.SoapHeader
{
public string Status { get; set; }
public string Message { get; set; }
}
var header = responseEnvelope
.Header<MeowResponseHeader >("{http://meow.com/}MeowHeader");
I kept looking for:
var header = responseEnvelope.Header<MeowResponseHeader >();
but had to write it myself...
The text was updated successfully, but these errors were encountered:
(using .net core - was getting weirdness with just GetType())
public static class SoapEnvelopeExtensions
{
public static T Header<T>(this SoapEnvelope envelope) where T : SoapHeader
{
var typeInfo = envelope.GetType().GetTypeInfo();
var attribute = typeInfo.GetCustomAttribute<XmlRootAttribute>();
var name = $"{attribute.Namespace}{attribute.ElementName}";
return envelope.Header<T>(name);
}
}
Why not just use the attributes attached to the class? It seems redundant.
I kept looking for:
var header = responseEnvelope.Header<MeowResponseHeader >();
but had to write it myself...
The text was updated successfully, but these errors were encountered: