Reputation: 1803
I'm trying to set the MessageHeader of a message that my Biztalk orchestration is sending to WCF. The Message Contract looks as follows in the WCF project.
[MessageContract(IsWrapped = true, WrapperName = "PerformTransformationRequestWrapper", WrapperNamespace="http://www.iasreo.com/integration/servicetypes")]
public class PerformTransformationRequest
{
[MessageHeader(Namespace = "http://www.iasreo.com/integration/servicetypes")]
public string Version { get; set; }
/// <summary>
///
/// </summary>
[MessageHeader(Namespace = "http://www.iasreo.com/integration/servicetypes", MustUnderstand = true)]
public TransformType TransformType { get; set; }
/// <summary>
///
/// </summary>
[MessageBodyMember(Namespace = "http://www.iasreo.com/integration/servicetypes")]
public System.IO.Stream Payload { get; set; }
}
TransformType.cs
[DataContract(Namespace = "http://www.iasreo.com/integration/servicetypes")]
public enum TransformType
{
/// <summary>
/// Transform to Excel
/// </summary>
[EnumMember]
ExcelTransform = 1,
/// <summary>
/// Transform to PDF
/// </summary>
[EnumMember]
PDFTransform = 2
}
I'm creating the message to send to Biztalk in a Message Assignment shape and that code looks as follows:
xmlDoc = new System.Xml.XmlDocument();
xmlDoc.LoadXml(@"<ns0:PerformTransformationRequestWrapper xmlns:ns0=""http://www.iasreo.com/integration/servicetypes""><ns0:Payload>GpM7</ns0:Payload></ns0:PerformTransformationRequestWrapper>");
PerformTransformationRequest = xmlDoc;
xpath(PerformTransformationRequest, "/*[local-name()='PerformTransformationRequestWrapper' and namespace-uri()='http://www.iasreo.com/integration/servicetypes']/*[local-name()='Payload']") = System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(Input.OuterXml));
How can I set the Version and TransformType that MessageHeaders in the WCF MessageContract?
Upvotes: 1
Views: 1130
Reputation: 1127
You can set the promoted WCF.OutboundCustomHeaders property of the outgoing message
OutboundMessage(WCF.OuboundCustomHeaders) = "...";
You need to supply the complete WCF Header string as the parameter.
This http://bencode.net/biztalk-custom-wcf-behaviour might be of use to you.
Upvotes: 1