|
Home > Archive > BizTalk Server Orchestration > August 2004 > Constructing a message in the Message Assignment Shape
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Constructing a message in the Message Assignment Shape
|
|
| Christoffer 2004-08-12, 2:46 am |
| Hello,
I'm about to construct a message using the Message Assignment Shape in my
Orchestration. Now, I found out in the BizTalk documentation
(http://msdn.microsoft.com/library/d...n-us/sdk/htm/eb
iz_prog_orch_guxr.asp) that the syntax for creating a message is:
MsgOut = CreateMsgHelper.Helper.GetXmlDocumentTemplate();
My message is a "SupplierAnswer" so I replaced the "MsgOut" with
"SupplierAnswer", that is:
SupplierAnswer = CreateMsgHelper.Helper.GetXmlDocumentTemplate();
But got the error "identifier CreateMsgHelper does not exist in...", so I
had a look at the Internet and found this piece of code:
InvoiceMsg = InvoiceMsgConstructor.Helper.GetXmlDocumentTemplate();
So I replaced "InvoiceMsg" with "SupplierAnswer", that is:
SupplierAnswer = SupplierAnswerConstructor.Helper.GetXmlDocumentTemplate();
But got the error "identifier SupplierAnswerConstructor does not exist
in...".
Could any please tell me what the syntax is for constructing the
SupplierAnswer message?
Thanks for any help,
Chris
| |
| Treudler 2004-08-12, 7:49 am |
| 1. You must create an Assembly that contain (from your url):
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;
}
2. in your Biz-project add the assembly to your references3. add the
assembly to GAC (gacuil /i /f filname)This sample create message from the
file C:\MyTemplateLocation\MyMsgTemplate.xml, do you want to have
this?Christian"Christoffer" <christoffer@nospam.com> wrote in message
news:O1dLDREgEHA.3416@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> I'm about to construct a message using the Message Assignment Shape in my
> Orchestration. Now, I found out in the BizTalk documentation
>
(http://msdn.microsoft.com/library/d...n-us/sdk/htm/eb
> iz_prog_orch_guxr.asp) that the syntax for creating a message is:
>
> MsgOut = CreateMsgHelper.Helper.GetXmlDocumentTemplate();
>
> My message is a "SupplierAnswer" so I replaced the "MsgOut" with
> "SupplierAnswer", that is:
>
> SupplierAnswer = CreateMsgHelper.Helper.GetXmlDocumentTemplate();
>
> But got the error "identifier CreateMsgHelper does not exist in...", so I
> had a look at the Internet and found this piece of code:
>
> InvoiceMsg = InvoiceMsgConstructor.Helper.GetXmlDocumentTemplate();
>
> So I replaced "InvoiceMsg" with "SupplierAnswer", that is:
>
> SupplierAnswer =
SupplierAnswerConstructor.Helper. GetXmlDocumentTemplate();
>
> But got the error "identifier SupplierAnswerConstructor does not exist
> in...".
>
> Could any please tell me what the syntax is for constructing the
> SupplierAnswer message?
>
> Thanks for any help,
> Chris
>
>
| |
| Alan Smith 2004-08-12, 7:49 am |
| Hi Chris,
There's a quick way to get this working. In the message assignemnt shape use
this code. (You will need to add msgXmlDoc as a XmlDocument orhestration
variable).
msgXmlDoc = new XmlDocument ();
msgXmlDoc.LoadXml (@" -- insert template XML for message here -- ");
msgGenerated = msgXmlDoc;
This means that you don't need to fool around with another
project/assembly/GAC registration
but you have to have the message template string hard-coded in the
orchestration (ungood).
Cheers,
Alan
----
BizTalk & .net
Consulting Training Mentoring
Stockholm London Europe
See aboutme for contact info
"Treudler" wrote:
> 1. You must create an Assembly that contain (from your url):
>
> 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;
> }
> 2. in your Biz-project add the assembly to your references3. add the
> assembly to GAC (gacuil /i /f filname)This sample create message from the
> file C:\MyTemplateLocation\MyMsgTemplate.xml, do you want to have
> this?Christian"Christoffer" <christoffer@nospam.com> wrote in message
> news:O1dLDREgEHA.3416@TK2MSFTNGP09.phx.gbl...
> (http://msdn.microsoft.com/library/d...n-us/sdk/htm/eb
> SupplierAnswerConstructor.Helper.GetXmlDocumentTemplate();
>
>
>
|
|
|
|
|