How do I convert an XML string to message nodes?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server Orchestration > How do I convert an XML string to message nodes?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How do I convert an XML string to message nodes?  
fullflavedave


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-02-06 12:14 AM

I am using the Assign Message shape in BizTalk 2006.  I want to take a strin
g
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 thei
r
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





[ Post a follow-up to this message ]



    Re: How do I convert an XML string to message nodes?  
Greg Forsythe


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-02-06 12:14 AM

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







[ Post a follow-up to this message ]



    Re: How do I convert an XML string to message nodes?  
fullflavedave


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-02-06 06: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 usi
ng
> 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... 
>
>
>





[ Post a follow-up to this message ]



    Re: How do I convert an XML string to message nodes?  
fullflavedave


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-03-06 12:14 AM

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 usi
ng
> 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... 
>
>
>





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:30 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register