BizTalk Server Orchestration - Message Construction

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > June 2004 > Message Construction





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 Message Construction
Neal Walters

2004-06-20, 11:09 pm

I'm trying to learn and explore how to construct a simple message (all distinguished fields from distinguished fields of another message) without having to do a Transform with a map. In other words, I might just want to copy 3 fields. I thought I had fi
gured out that an Orchestration was a System.Xml.XmlDocument, but according to a Charles Young blog, it's really a Microsoft.XLANGs.Core.XMessage???

I teach Biztalk 2004 classes, and I need to show how to construct a simple reply message. For example, I have a one orchestration sending a PO (Purchase Order) to a fictitious trading partner, and I want to send back a confirmation message.

The following compiles but gives a nasty runtime error (which I will display below).

//mPOConfirm = new System.Xml.XmlDocument();
testdoc = new System.Xml.XmlDocument();
// I copied in a sample instance here - after getting the message
// about fields not existing or not being initialized.
testdoc.LoadXml ( "<ns0:POConfirmation xmlns:ns0='http://EasyPOCorrelation.POConfirmation'><PONum>PONum_0</PONum><ConfirmationDate>1999-05-31T13:20:00.000-05:00</ConfirmationDate><ConfirmationAmount>10.4</ConfirmationAmount></ns0:POConfirmation>");
mPOConfirm = testdoc;
// This is really what I wanted to do. mPOConfirm and mEasyPO
// are two messages:
//mPOConfirm.PONum = mEasyPO.PONum;
//mPOConfirm.ConfirmationDate = System.DateTime.Now;
//mPOConfirm.ConfirmationAmount = mEasyPO.TotalAmount;

Msg Details shows the following:

A failure occurred while evaluating the distinguished field PONum against the message part data. The message part data does not contain at least one of the nodes specified by the XPath expression (listed below) that corresponds to the distinguished field.
The cause for this error may be that the message part data has not been initialized or that the message part data does not conform to the message part schema. Ensure that the message part data is initialized correctly.
XPath expression: /*[local-name()='P

HAT does not let me copy/paste the longer message. Right-click, "Copy" does not show up. So I will try to type it below:

0x80004005 Microsoft.XLANGs.Runtime Types.XPath.Update Exception: A failure occured while evaluating the distinguished field PONum against the message part data. The message part data does not contain at least one of the nodes specified by the XPath expr
ession (listed below) that corresponds to the distinguished field. The cause for this error ma be that the message part data has not been initialized or that the message part data does not conform to the message part schema. Ensure that the message part
data is initialized correctly.
XPath expressions: /*[local-name()="POConfirmation" and namespace-uri()="Http://EasyPOCorrelation.POCofirmation"]/[local-name()="PONum" and namespace-uri()="]
at microsoft.XLANGs.CoreXSDPart.SetDistinguishedField(String dottedPath, Object val)
at EasyPOCorrelation.POCorrelatioSeller segment1(Stop Conditions stopOn)
at Microsoft.LANGx.Core.Segment.Scheduler.RunASegment(Segment s, StopConidtions stopCond Exception& exp)
Microsoft.XLANGs.Runtime Types.XPathUpdateException

Thanks,
Neal
http://Biztalk-Trainers.com







Matt Milner

2004-06-20, 11:09 pm

What is the schema type for your PO number? Does the XML you are using
below validate against the schema?

You are on the right track. It sounds like you might just have a problem
with the XML you are using, or the value you
are supplying for the distinguished property.

Matt


"Neal Walters" <Neal Walters@discussions.microsoft.com> wrote in message
news:71CCF891-C0A4-402F-96E8-42D665D2D937@microsoft.com...
> I'm trying to learn and explore how to construct a simple message (all

distinguished fields from distinguished fields of another message) without
having to do a Transform with a map. In other words, I might just want to
copy 3 fields. I thought I had figured out that an Orchestration was a
System.Xml.XmlDocument, but according to a Charles Young blog, it's really a
Microsoft.XLANGs.Core.XMessage???
>
> I teach Biztalk 2004 classes, and I need to show how to construct a simple

reply message. For example, I have a one orchestration sending a PO
(Purchase Order) to a fictitious trading partner, and I want to send back a
confirmation message.
>
> The following compiles but gives a nasty runtime error (which I will

display below).
>
> //mPOConfirm = new System.Xml.XmlDocument();
> testdoc = new System.Xml.XmlDocument();
> // I copied in a sample instance here - after getting the message
> // about fields not existing or not being initialized.
> testdoc.LoadXml ( "<ns0:POConfirmation

xmlns:ns0='http://EasyPOCorrelation.POConfirmation'><PONum>PONum_0</PONum><C
onfirmationDate>1999-05-31T13:20:00.000-05:00</ConfirmationDate><Confirmatio
nAmount>10.4</ConfirmationAmount></ns0:POConfirmation>");
> mPOConfirm = testdoc;
> // This is really what I wanted to do. mPOConfirm and mEasyPO
> // are two messages:
> //mPOConfirm.PONum = mEasyPO.PONum;
> //mPOConfirm.ConfirmationDate = System.DateTime.Now;
> //mPOConfirm.ConfirmationAmount = mEasyPO.TotalAmount;
>
> Msg Details shows the following:
>
> A failure occurred while evaluating the distinguished field PONum against

the message part data. The message part data does not contain at least one
of the nodes specified by the XPath expression (listed below) that
corresponds to the distinguished field. The cause for this error may be that
the message part data has not been initialized or that the message part data
does not conform to the message part schema. Ensure that the message part
data is initialized correctly.
> XPath expression: /*[local-name()='P
>
> HAT does not let me copy/paste the longer message. Right-click, "Copy"

does not show up. So I will try to type it below:
>
> 0x80004005 Microsoft.XLANGs.Runtime Types.XPath.Update Exception: A

failure occured while evaluating the distinguished field PONum against the
message part data. The message part data does not contain at least one of
the nodes specified by the XPath expression (listed below) that corresponds
to the distinguished field. The cause for this error ma be that the message
part data has not been initialized or that the message part data does not
conform to the message part schema. Ensure that the message part data is
initialized correctly.
> XPath expressions: /*[local-name()="POConfirmation" and

namespace-uri()="Http://EasyPOCorrelation.POCofirmation"]/[local-name()="PON
um" and namespace-uri()="]
> at microsoft.XLANGs.CoreXSDPart.SetDistinguishedField(String dottedPath,

Object val)
> at EasyPOCorrelation.POCorrelatioSeller segment1(Stop Conditions stopOn)
> at Microsoft.LANGx.Core.Segment.Scheduler.RunASegment(Segment s,

StopConidtions stopCond Exception& exp)
> Microsoft.XLANGs.Runtime Types.XPathUpdateException
>
> Thanks,
> Neal
> http://Biztalk-Trainers.com
>
>
>
>
>
>
>



Neal Walters

2004-06-20, 11:09 pm

The xml I used in the LoadXml was created by doing a generate instance on the schema.

Ideally, I would like to do just the following:
mPOConfirm.PONum = mEasyPO.PONum;
mPOConfirm.ConfirmationDate = System.DateTime.Now;
mPOConfirm.ConfirmationAmount = mEasyPO.TotalAmount;

Q1) Do I have to somehow establish the three elements before I can set their values?

Q2) Do I have to build an intermediate variable of type System.XML.XMLDocument and instantitate it?

Q3) The original code below seems to be blowing on: mPOConfirm = testdoc;
Why doesn't the exception give me the line number in my code that it is blowing on?

Q4) Does the Orchestration debugger have the power to walk through one line at a time in an Expression Editor?

Thanks for your help!
Neal




//mPOConfirm = new System.Xml.XmlDocument();
testdoc = new System.Xml.XmlDocument();
// I copied in a sample instance here - after getting the message
// about fields not existing or not being initialized.
testdoc.LoadXml ( "<ns0:POConfirmation xmlns:ns0='http://EasyPOCorrelation.POConfirmation'><PONum>PONum_0</PONum><ConfirmationDate>1999-05-31T13:20:00.000-05:00</ConfirmationDate><ConfirmationAmount>10.4</ConfirmationAmount></ns0:POConfirmation>");
mPOConfirm = testdoc;
// This is really what I wanted to do. mPOConfirm and mEasyPO
// are two messages:
//mPOConfirm.PONum = mEasyPO.PONum;
//mPOConfirm.ConfirmationDate = System.DateTime.Now;
//mPOConfirm.ConfirmationAmount = mEasyPO.TotalAmount;


"Matt Milner" wrote:

> What is the schema type for your PO number? Does the XML you are using
> below validate against the schema?
>
> You are on the right track. It sounds like you might just have a problem
> with the XML you are using, or the value you
> are supplying for the distinguished property.
>
> Matt
>
>
> "Neal Walters" <Neal Walters@discussions.microsoft.com> wrote in message
> news:71CCF891-C0A4-402F-96E8-42D665D2D937@microsoft.com...
> distinguished fields from distinguished fields of another message) without
> having to do a Transform with a map. In other words, I might just want to
> copy 3 fields. I thought I had figured out that an Orchestration was a
> System.Xml.XmlDocument, but according to a Charles Young blog, it's really a
> Microsoft.XLANGs.Core.XMessage???
> reply message. For example, I have a one orchestration sending a PO
> (Purchase Order) to a fictitious trading partner, and I want to send back a
> confirmation message.
> display below).
> xmlns:ns0='http://EasyPOCorrelation.POConfirmation'><PONum>PONum_0</PONum><C
> onfirmationDate>1999-05-31T13:20:00.000-05:00</ConfirmationDate><Confirmatio
> nAmount>10.4</ConfirmationAmount></ns0:POConfirmation>");
> the message part data. The message part data does not contain at least one
> of the nodes specified by the XPath expression (listed below) that
> corresponds to the distinguished field. The cause for this error may be that
> the message part data has not been initialized or that the message part data
> does not conform to the message part schema. Ensure that the message part
> data is initialized correctly.
> does not show up. So I will try to type it below:
> failure occured while evaluating the distinguished field PONum against the
> message part data. The message part data does not contain at least one of
> the nodes specified by the XPath expression (listed below) that corresponds
> to the distinguished field. The cause for this error ma be that the message
> part data has not been initialized or that the message part data does not
> conform to the message part schema. Ensure that the message part data is
> initialized correctly.
> namespace-uri()="Http://EasyPOCorrelation.POCofirmation"]/[local-name()="PON
> um" and namespace-uri()="]
> Object val)
> StopConidtions stopCond Exception& exp)
>
>
>

Neal Walters

2004-06-20, 11:09 pm

Today I tried the following and it ran (not really sure what is different from yesterday), but with just as strange results:

testdoc = new System.Xml.XmlDocument();
testdoc.LoadXml ( "<ns0:POConfirmation xmlns:ns0='http://EasyPOCorrelation.POConfirmation'><PONum>PONum_0</PONum><ConfirmationDate>1999-05-31T13:20:00.000-05:00</ConfirmationDate><ConfirmationAmount>10.4</ConfirmationAmount></ns0:POConfirmation>");
System.Diagnostics.Debug.WriteLine(testdoc);
mPOConfirm = testdoc;
mPOConfirm.PONum = mEasyPO.PONum;
mPOConfirm.PONum = "override";
mPOConfirm.ConfirmationDate = System.DateTime.Now;
mPOConfirm.ConfirmationAmount = mEasyPO.TotalAmount;

The file sent written out looks like this:
<?xml version="1.0" encoding="utf-8"?><ns0:POConfirmation xmlns:ns0="http://EasyPOCorrelation.POConfirmation">
<PONum>PONum_0</PONum>
<ConfirmationDate>1999-05-31T13:20:00.000-05:00</ConfirmationDate>
<ConfirmationAmount>10.4</ConfirmationAmount>
</ns0:POConfirmation>

In other words, statements like mPOConfirm.PONum = "override"; seem to have been ignored. The PONum in the output file has a value of "PONum_0" instead of "override".

What's up? Am I missing somethiing obvious here???

Neal

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com