BizTalk Server Orchestration - Message Assignment - Can Schema Be Used vs Hardcoding?

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > February 2006 > Message Assignment - Can Schema Be Used vs Hardcoding?





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 Assignment - Can Schema Be Used vs Hardcoding?
CranCran77

2006-02-05, 5:06 pm

I have an orchestration that performs an insert into TableA and
multiple child records into TableB. What I have to do is make an
initial call to my database to get a sequence id that I use to uniquely
identify the relationship between TableA's record and TableB's records.

I have defined a variable in my Orchestration called "varXmlDocument"
that is of System.Xml.XmlDocument. In a message assignment shape, I do
the following:

varXmlDocument = new System.Xml.XmlDocument();
varXmlDocument.LoadXml(@"<ns0:GetSeqA
xmlns:ns0=""http://Project/GetSeqA""/>");
HeaderSeqMessage = varXmlDocument;

Is there a way to assign the XML to the XmlDocument variable without
actually having to "hard-code" the xml document? Would it be possible
to utilize the schema in the project to do this as so if the schema
changes, this shape does not formulate an invalid XML document?

Tomas Restrepo \(MVP\)

2006-02-05, 5:06 pm

CranCran,

>I have an orchestration that performs an insert into TableA and
> multiple child records into TableB. What I have to do is make an
> initial call to my database to get a sequence id that I use to uniquely
> identify the relationship between TableA's record and TableB's records.
>
> I have defined a variable in my Orchestration called "varXmlDocument"
> that is of System.Xml.XmlDocument. In a message assignment shape, I do
> the following:
>
> varXmlDocument = new System.Xml.XmlDocument();
> varXmlDocument.LoadXml(@"<ns0:GetSeqA
> xmlns:ns0=""http://Project/GetSeqA""/>");
> HeaderSeqMessage = varXmlDocument;
>
> Is there a way to assign the XML to the XmlDocument variable without
> actually having to "hard-code" the xml document? Would it be possible
> to utilize the schema in the project to do this as so if the schema
> changes, this shape does not formulate an invalid XML document?


Unfortunately, no, you can't really use the schema itself to generate it, in
general terms (it would be possible for very basic schemas, but difficult to
generalize completely).

What you can do is move your XML out of a string literal in your
orchestration. Scott Colestock shows a very nice way of doing it with
embedded resources in a utility .NET Assembly, which makes it far easier to
manipulate and maintain:

http://www.traceofthought.net/Perma...e4e8dc46d4.aspx



--
Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/


CranCran77

2006-02-05, 8:46 pm

This is a pretty neat idea and concept. Not too bad when you have
already designed your solution in such a way that you have a schema
only assembly and supporting assemblies that contain your
orchestrations and so forth... Thanks!

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com