none
Unable to promote SOAP header values to BizTalk Message Context Property RRS feed

  • Question

  • Hello,

    I am trying to promote a context property from my WCF application to a orchestration following this Microsoft technet:  http://technet.microsoft.com/en-us/library/bb246105(v=bts.20).aspx inside "AfterReceiveRequest" WCF method.

    If I try to write a "Not Promoted" property using this code, it works:

    const string PropertiesToWriteKey = "http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties/WriteToContext";
    
    List<KeyValuePair<XmlQualifiedName, object>> writeProps = new List<KeyValuePair<XmlQualifiedName, object>>();
    writeProps.Add(new KeyValuePair<XmlQualifiedName, object>(PropName2, "Property value"));
    request.Properties[PropertiesToWriteKey] = writeProps;

    However, the code to "Promote" the property, fails:

    const string PropertiesToPromoteKey = "http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties/Promote";
    List<KeyValuePair<XmlQualifiedName, object>> promoteProps = new List<KeyValuePair<XmlQualifiedName, object>>();
    promoteProps.Add(new KeyValuePair<XmlQualifiedName, object>(PropName1, "Property value"));
    request.Properties[PropertiesToPromoteKey] = promoteProps;

    I am getting the error described in this post: http://social.msdn.microsoft.com/Forums/is/biztalkr2adapters/thread/fedadd52-20f5-4e14-bc0a-07dd7b6596b5

    Moreover, If I try to use the cmd sentence:

    btstask addresource /type:System.BizTalk:BizTalkAssembly /Overwrite /Source:Microsoft.BizTalk.GlobalPropertySchemas.dll

    I also get the same error as the post.

    Any ideas to resolve this issue?

    Thank you in advance.

    Alex

    Tuesday, March 6, 2012 4:44 PM

Answers

  • Hi,

    Great! It finally works. The problem was in the property namespace because it has to be in the Application Schemas in Biztalk. Also, if you need to have the context property promoted, the schema has to have this property inside. Here is the code which works if anybody needs it:

    const string namespaceTest = "http://Services.Test";
    const string PropertiesToPromoteKey = "http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties/Promote";
    
    XmlQualifiedName PropName1 = new XmlQualifiedName("TestProperty", namespaceTest);
    
    List<KeyValuePair<XmlQualifiedName, object>> promoteProps = new List<KeyValuePair<XmlQualifiedName, object>>();
    promoteProps.Add(new KeyValuePair<XmlQualifiedName, object>(PropName1, "TEST text"));
                        request.Properties[PropertiesToPromoteKey] = promoteProps;

    Thank you anyway

    Alex

    • Marked as answer by Alex_Asturias Wednesday, March 7, 2012 10:22 AM
    Wednesday, March 7, 2012 10:22 AM