次の方法で共有


XSD スキーマとして表されるメッセージ

XSD メッセージの種類のテンプレート XML インスタンスは、デザイン時に定義されてディスクに格納されます。 実行時には、XML は .NET コンポーネントによってディスクから取得され、XmlDocument として返されます。 オーケストレーション コードでは、オーケストレーションで宣言されているメッセージ インスタンスに、この XmlDocument 結果を割り当てることができます。

[メッセージの割り当て] 図形には、1 行のコードがあります。

MsgOut = CreateMsgHelper.Helper.GetXmlDocumentTemplate();  

XmlDocument を作成するヘルパー コンポーネントには、次に示す単一の静的メソッドが含まれています。

private static XmlDocument _template = null;  
private static object _sync = new object();  
private static String LOCATION = @"C:\MyTemplateLocation\MyMsgTemplate.xml";  
  
public static XmlDocument GetXmlDocumentTemplate()  
{  
   XmlDocument doc = _template;  
   if (doc == null)  
   {  
      // Load the doc template from disk.  
      doc = new XmlDocument();  
      XmlTextReader reader = new XmlTextReader(LOCATION);  
      doc.Load(reader);  
  
      // Synchronize assignment to _template.  
      lock (_sync)  
      {  
         XmlDocument doc2 = _template;  
         if (doc2 == null)  
         {  
            _template = doc;  
         }  
         else  
         {  
            // Another thread beat us to it.  
            doc = doc2;  
         }  
      }  
   }  
  
   // Need to explicitly create a clone so that we are not  
   // referencing the same object statically held by this class.  
   doc = (XmlDocument) doc.CloneNode(true);  
   return doc;  
}  

参照

.NET クラスとして表されるメッセージ
XLANGMessage として表されるメッセージ
ユーザー コードでのメッセージの構築