Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.ServiceModel.Channels;
using System.Xml;
namespace RoyalMail
{
public class RoyalMailMessage : Message
{
private readonly Message message;
public RoyalMailMessage(Message message)
{
this.message = message;
}
public override MessageHeaders Headers => message.Headers;
public override MessageProperties Properties => message.Properties;
public override MessageVersion Version => message.Version;
protected override void OnWriteStartBody(XmlDictionaryWriter writer)
{
writer.WriteStartElement("soapenv","Body", "http://schemas.xmlsoap.org/soap/envelope/");
}
protected override void OnWriteStartHeaders(XmlDictionaryWriter writer)
{
writer.WriteStartElement("soapenv", "Header", null);
}
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
message.WriteBodyContents(writer);
}
protected override void OnWriteStartEnvelope(XmlDictionaryWriter writer)
{
writer.WriteStartElement("soapenv", "Envelope", "http://schemas.xmlsoap.org/soap/envelope/");
writer.WriteAttributeString("xmlns", "oas", null, "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
writer.WriteAttributeString("xmlns", "v2", null, "http://www.royalmailgroup.com/api/ship/V2");
writer.WriteAttributeString("xmlns", "v1", null, "http://www.royalmailgroup.com/integration/core/V1");
writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment