BizTalk で使用する基本的な一方向のカスタム WCF LOB アダプターを作成しようとしています。ただし、ターゲット システムが Xml メッセージをサポートしているとは限りません。カスタム WCF アダプターを通過するメッセージは XML エンベロープでラップされ、メッセージ本文は次の 4 つの方法のいずれかでエンコードできることを理解しています。
- XML
- 弦
- BinHex
- Base64
この設定はOutbound WCF message body
、次の XML フラグメントのようなプロパティを受け入れるプロパティの構成によって管理されます。
<bts-msg-body xmlns='http://www.microsoft.com/schemas/bts2007' encoding='[xml|base64|hex|string]'/>
Execute
私のクラスのメソッドの実装ではCustomAdapterOutboundHandler
、送信ポート構成で指定されたエンコーディングをどのように取得できますか?
/// <summary>
/// Executes the request message on the target system and returns a response message.
/// If there isn’t a response, this method should return null
/// </summary>
public Message Execute(Message message, TimeSpan timeout)
{
// ISSUE: how to retrieve the message body as binary byte[] / stream / whatever ?
// <bts-msg-body xmlns='http://www.microsoft.com/schemas/bts2007' encoding='[xml|base64|hex|string]'/>
System.Xml.XmlDictionaryReader reader = message.GetReaderAtBodyContents();
return null;
}