Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Construct Message from Orch Parameters 1

Status
Not open for further replies.

rodmcleay

Programmer
Jun 20, 2005
11
AU
I am not sure what I am doing wrong.

I have four variables that are passed to an orchestration.
I have a message within that orchestration called ErrorNotice.
I want to assign the four variable parameters to the corresponding fields in the error notice message.
The message fields are promoted as distinguished fields.

This is the code I am using now:
=============================
ErrorNotice = new System.Xml.XmlDocument();
//Message.Field = Parameter
ErrorNotice.ErrorCode = ErrorCode;
ErrorNotice.ErrorDescription = ErrorDescription;
ErrorNotice.ErrorLocation = ErrorLocation;
ErrorNotice.ErrorResolution = ErrorResolution;
=====================================

This code is generating the following error
====================================
Microsoft.XLANGs.RuntimeTypes.XPathUpdateException: A failure occurred while evaluating the distinguished field ErrorCode 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()='ErrorNotice' and namespace-uri()=']/*[local-name()='ErrorCode' and namespace-uri()='']

at Microsoft.XLANGs.Core.XSDPart.SetDistinguishedField(String dottedPath, Object val)

at BHPB.E2E.Orchestrations.Common_ErrorNotice.segment1(StopConditions stopOn)

at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
Microsoft.XLANGs.RuntimeTypes.XPathUpdateException


====================================

Any assistance would be greatly appreciated.
 
Did you try to assign a template to the message rather than declaring it as XmlDocument. I would think that there is the error. An XmlDocument is not the same as a BizTalk Message. It misses all of the Property Bag where your distinguished fields are located. So what you could try is that:

Orchestration Varibale of Type XmlDocument myTempXml
Orchestration Message of Type ErrorNotice myErrorNotice

Then in your first Expression Shape go
myTempXml = new System.Xml.XmlDocument();
myTempXml.LoadXml("<root></root>");

Then you need a create Message Shape, and an assign Message Shape.
In you assign Message shape do this:
myErrorNotice = myTempXml;
myErrorNotice.ErrorCode = ErrorCode;
myErrorNotice.ErrorDescription = ErrorDescription;
myErrorNotice.ErrorLocation = ErrorLocation;
myErrorNotice.ErrorResolution = ErrorResolution;

You also want to have at look at this blog entry:


HTH,

Stephan
 
Thanks heaps for that Stephan,

Does the instantiated XmlDocument, myTempXml,have to contain the same schema as myErrorNotice.
Or can I just include the root node like you have above.

Thanks again for your assistance.

Rod
 
Stephan,
I have answered that myself now.
I had to include the elements that I wished to assign variables to.
I have this working now and have very much appreciated your assistance.
It seems a little convoluted to have to create a xml doc with the message structure to assign to hte message in order to use this feature.
It means that I have to maintain the schema in two places.

Thanks again
Rod
 
I know it is weird that creating a new message is sooo difficult in BizTalk. Maybe they fixed that in the 2006 edition, that will be released this fall. ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top