Last active
June 11, 2018 16:26
-
-
Save skenderbeu/0c3643afa5fd7b51e5087d8949042338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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