BizTalk Server Orchestration - How do I convert an XML string to message nodes?

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > June 2006 > How do I convert an XML string to message nodes?





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 How do I convert an XML string to message nodes?
fullflavedave

2006-06-01, 7:14 pm

I am using the Assign Message shape in BizTalk 2006. I want to take a string
that contains XML
("<recordType1><recordType2><element></element></recordType2></recordType2>")
and assign it to a message node. How would I do this? I guess my main
question is this: what kind of .NET types are the message nodes? I have
tried XMLNode and XMLNodeList and even XMLDocument, but none work.

My code in the expression editor is below (the last assignment statement
doesn't work). NewExpandedResponse is a message whose schema I have created.
ExecuteResult is a node of type string, but it only contains XML. I want to
take this XML that is in String form in this node and assign it to the XML
node in my message, NewExpandedResponse.ExecuteResult.returnXml. returnXml
is a complexType with child nodes mathing the structure of the XML string in
ExecuteResult. I have created xmlDocument and xmlNode as variables (of their
namesake types) within the orchestration.

....
xmlDocument.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
xmlNode = xmlDocument.CloneNode(true);
NewExpandedResponse.ExecuteResult.returnXml = xmlNode;

The error I get is "can't implicitly convert type System.XML.XmlNode to type
OnyxOrgRegExpandedResponse.ExecuteResult.returnXml"


Any help is much appreciated!

Thanks,
Dave
Greg Forsythe

2006-06-01, 7:14 pm

Dave,

You cannot directly manipulate the Xlang message by assigning nodes.
And you have to create the NewExpandedResponse first by using a map or using
an XmlDocument object.

You can use an xmlDocument to do this.

xmlDocument1.LoadXml("string of NewExpandedresponse");
xmlDocument2.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
<manipulate nodes of doc1 and doc2 using clone append, etc>
NewExpandedResponse = xmlDocument1;

You can use the xpath function:
I have not tried this mechanism of assigning a node via xpath only node
content but it is supposed to work

xmlDocument1.LoadXml("string of NewExpandedresponse");
NewExpandedResponse = xmlDocument1;
xmlDocument2.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
xpath(NewExpandedResponse, "xpath string") = xmlDocument.DocumentElement;

You can use a transform to merge two messages:

xmlDocument1.LoadXml("string of NewExpandedresponse");
NewExpandedResponse = xmlDocument1;
xmlDocument2.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
OnyxResponseMessage = xmlDocument2;
Then add a transform shape after the messageassignment.
Add NewExpandedResponse and OnyxResponseMessage as source document and
create a new map.
Biztalk will concatenate the two messages together and pass then to the
transform shape

You can use properties or distinguished fields to assign node values, how
many nodes are in OnyxOrgRegResponseMessage.ExecuteResult

Greg


"fullflavedave" <fullflavedave@discussions.microsoft.com> wrote in message
news:02CE01E1-922D-4179-AF32-421EF635B2DF@microsoft.com...
>I am using the Assign Message shape in BizTalk 2006. I want to take a
>string
> that contains XML
> ("<recordType1><recordType2><element></element></recordType2></recordType2>")
> and assign it to a message node. How would I do this? I guess my main
> question is this: what kind of .NET types are the message nodes? I have
> tried XMLNode and XMLNodeList and even XMLDocument, but none work.
>
> My code in the expression editor is below (the last assignment statement
> doesn't work). NewExpandedResponse is a message whose schema I have
> created.
> ExecuteResult is a node of type string, but it only contains XML. I want
> to
> take this XML that is in String form in this node and assign it to the XML
> node in my message, NewExpandedResponse.ExecuteResult.returnXml.
> returnXml
> is a complexType with child nodes mathing the structure of the XML string
> in
> ExecuteResult. I have created xmlDocument and xmlNode as variables (of
> their
> namesake types) within the orchestration.
>
> ...
> xmlDocument.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
> xmlNode = xmlDocument.CloneNode(true);
> NewExpandedResponse.ExecuteResult.returnXml = xmlNode;
>
> The error I get is "can't implicitly convert type System.XML.XmlNode to
> type
> OnyxOrgRegExpandedResponse.ExecuteResult.returnXml"
>
>
> Any help is much appreciated!
>
> Thanks,
> Dave



fullflavedave

2006-06-02, 1:14 pm

Thanks for this very thorough reply -- I'm psyched to try some of these
options out.

With Gratitude,
Dave



"Greg Forsythe" wrote:

> Dave,
>
> You cannot directly manipulate the Xlang message by assigning nodes.
> And you have to create the NewExpandedResponse first by using a map or using
> an XmlDocument object.
>
> You can use an xmlDocument to do this.
>
> xmlDocument1.LoadXml("string of NewExpandedresponse");
> xmlDocument2.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
> <manipulate nodes of doc1 and doc2 using clone append, etc>
> NewExpandedResponse = xmlDocument1;
>
> You can use the xpath function:
> I have not tried this mechanism of assigning a node via xpath only node
> content but it is supposed to work
>
> xmlDocument1.LoadXml("string of NewExpandedresponse");
> NewExpandedResponse = xmlDocument1;
> xmlDocument2.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
> xpath(NewExpandedResponse, "xpath string") = xmlDocument.DocumentElement;
>
> You can use a transform to merge two messages:
>
> xmlDocument1.LoadXml("string of NewExpandedresponse");
> NewExpandedResponse = xmlDocument1;
> xmlDocument2.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
> OnyxResponseMessage = xmlDocument2;
> Then add a transform shape after the messageassignment.
> Add NewExpandedResponse and OnyxResponseMessage as source document and
> create a new map.
> Biztalk will concatenate the two messages together and pass then to the
> transform shape
>
> You can use properties or distinguished fields to assign node values, how
> many nodes are in OnyxOrgRegResponseMessage.ExecuteResult
>
> Greg
>
>
> "fullflavedave" <fullflavedave@discussions.microsoft.com> wrote in message
> news:02CE01E1-922D-4179-AF32-421EF635B2DF@microsoft.com...
>
>
>

fullflavedave

2006-06-02, 7:14 pm

After playing with XmlNode.Replace() and XmlNode.Append without success, I
finally realized that the simplest solution would work. Here is what I
finally used:

newXmlDoc.LoadXml("<ExecuteResponse><ExecuteResult>" +
OnyxOrgRegResponseMessage.ExecuteResult +
"</ExecuteResult></ExecuteResponse>");
OnyxExpandedResponse = newXmlDoc;


Thanks for your help!

Dave


"Greg Forsythe" wrote:

> Dave,
>
> You cannot directly manipulate the Xlang message by assigning nodes.
> And you have to create the NewExpandedResponse first by using a map or using
> an XmlDocument object.
>
> You can use an xmlDocument to do this.
>
> xmlDocument1.LoadXml("string of NewExpandedresponse");
> xmlDocument2.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
> <manipulate nodes of doc1 and doc2 using clone append, etc>
> NewExpandedResponse = xmlDocument1;
>
> You can use the xpath function:
> I have not tried this mechanism of assigning a node via xpath only node
> content but it is supposed to work
>
> xmlDocument1.LoadXml("string of NewExpandedresponse");
> NewExpandedResponse = xmlDocument1;
> xmlDocument2.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
> xpath(NewExpandedResponse, "xpath string") = xmlDocument.DocumentElement;
>
> You can use a transform to merge two messages:
>
> xmlDocument1.LoadXml("string of NewExpandedresponse");
> NewExpandedResponse = xmlDocument1;
> xmlDocument2.LoadXml(OnyxOrgRegResponseMessage.ExecuteResult);
> OnyxResponseMessage = xmlDocument2;
> Then add a transform shape after the messageassignment.
> Add NewExpandedResponse and OnyxResponseMessage as source document and
> create a new map.
> Biztalk will concatenate the two messages together and pass then to the
> transform shape
>
> You can use properties or distinguished fields to assign node values, how
> many nodes are in OnyxOrgRegResponseMessage.ExecuteResult
>
> Greg
>
>
> "fullflavedave" <fullflavedave@discussions.microsoft.com> wrote in message
> news:02CE01E1-922D-4179-AF32-421EF635B2DF@microsoft.com...
>
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com