Note that there are some explanatory texts on larger screens.

plurals
  1. POBiztalk set WCF MessageHeaders in Biztalk message assignment
    text
    copied!<p>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.</p> <pre><code> [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; } /// &lt;summary&gt; /// /// &lt;/summary&gt; [MessageHeader(Namespace = "http://www.iasreo.com/integration/servicetypes", MustUnderstand = true)] public TransformType TransformType { get; set; } /// &lt;summary&gt; /// /// &lt;/summary&gt; [MessageBodyMember(Namespace = "http://www.iasreo.com/integration/servicetypes")] public System.IO.Stream Payload { get; set; } } </code></pre> <p>TransformType.cs</p> <pre><code>[DataContract(Namespace = "http://www.iasreo.com/integration/servicetypes")] public enum TransformType { /// &lt;summary&gt; /// Transform to Excel /// &lt;/summary&gt; [EnumMember] ExcelTransform = 1, /// &lt;summary&gt; /// Transform to PDF /// &lt;/summary&gt; [EnumMember] PDFTransform = 2 } </code></pre> <p>I'm creating the message to send to Biztalk in a Message Assignment shape and that code looks as follows:</p> <pre><code>xmlDoc = new System.Xml.XmlDocument(); xmlDoc.LoadXml(@"&lt;ns0:PerformTransformationRequestWrapper xmlns:ns0=""http://www.iasreo.com/integration/servicetypes""&gt;&lt;ns0:Payload&gt;GpM7&lt;/ns0:Payload&gt;&lt;/ns0:PerformTransformationRequestWrapper&gt;"); 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)); </code></pre> <p>How can I set the Version and TransformType that MessageHeaders in the WCF MessageContract?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload