BizTalk Server Orchestration - Message Assignment

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > January 2006 > Message Assignment





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
mm

2006-01-27, 9:27 pm

I am playing around with some orchestration fuzz.
I cant understand why i cant change the message biztalk is sending out i
have tried all sorts of things i.e:
I initalize msgShipping which is the .net xmldocument with the
customerparams (so i wont get i compiler error)
afterwards i try to change it but nothing happens, the original message
comes out (customerparams).
It is like need some commit command or something what is going on.

msgShipping = Customer_Param;
msgShipping.RemoveAll();
msgShipping.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
"<title>Pride And Prejudice</title>" + "</book>");

XmlNode = msgShipping.DocumentElement;

//Create a new title element.
XmlElement = msgShipping.CreateElement("title");
XmlElement.InnerText="The Handmaid's Tale";

//Replace the title element.
XmlNode.ReplaceChild(XmlElement, XmlNode.FirstChild);


BA

2006-01-27, 9:27 pm

Hello mm,

A BizTalk message is immutable, meaning it cant be changed, that is why you
cant see anything different in the message, regardless of its type.

You might consider a message assignment to a new message name, or using a
variable of type XmlDocument to update the message and then assign it back.

Cheers,
BA
http://biztalkia.blogspot.com/



> I am playing around with some orchestration fuzz.
> I cant understand why i cant change the message biztalk is sending out
> i
> have tried all sorts of things i.e:
> I initalize msgShipping which is the .net xmldocument with the
> customerparams (so i wont get i compiler error)
> afterwards i try to change it but nothing happens, the original
> message
> comes out (customerparams).
> It is like need some commit command or something what is going on.
> msgShipping = Customer_Param;
> msgShipping.RemoveAll();
> msgShipping.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
> "<title>Pride And Prejudice</title>" + "</book>");
> XmlNode = msgShipping.DocumentElement;
>
> //Create a new title element.
> XmlElement = msgShipping.CreateElement("title");
> XmlElement.InnerText="The Handmaid's Tale";
> //Replace the title element.
> XmlNode.ReplaceChild(XmlElement, XmlNode.FirstChild);



Morten Moos

2006-01-27, 9:27 pm

thanks for answer

ok, but how can i make my "book" xmldocument, if i try to change the
xmlmessage before i initialize it, it comes with the the error "use of
unconstructed message"
if i construct it, i cant change it...




"BA" wrote:

> Hello mm,
>
> A BizTalk message is immutable, meaning it cant be changed, that is why you
> cant see anything different in the message, regardless of its type.
>
> You might consider a message assignment to a new message name, or using a
> variable of type XmlDocument to update the message and then assign it back.
>
> Cheers,
> BA
> http://biztalkia.blogspot.com/
>
>
>
>
>
>

Yossi Dahan

2006-01-27, 9:27 pm

Morten Moos wrote:[vbcol=seagreen]
> thanks for answer
>
> ok, but how can i make my "book" xmldocument, if i try to change the
> xmlmessage before i initialize it, it comes with the the error "use of
> unconstructed message"
> if i construct it, i cant change it...
>
>
>
>
> "BA" wrote:
>
>
The idea is that you can only modify the message when constructing it.
but you are not limited to a single operation while constructing it.
You do, however, have to start with an existing message unfortunately.
so - one option is to map an existing message to your new message, even
if the mapping does nothing essentially.
then you can use a second shape in the message construction container to
modify your message with the correct contents.

another options is to start with an XmlDocument instantiation inside a
message assignment shape. you can have code to load an Xml instance
(hard coded, or from a file or any other source) to instantiate the
XmlDocument with the correct contents.

like with he map option you can then use whatever code you need to
modify the loaded Xml as long as you do it within the message
construction container.

Hope this helps

Yossi Dahan

--
Yossi Dahan
www.sabratech.co.uk
Morten Moos

2006-01-27, 9:27 pm

thanks yossi!

I get the idea and have succesfully made my own custom xmldocument inside
the orchestration
now hopefuly i can use this in my next tast i the project

"Yossi Dahan" wrote:

> Morten Moos wrote:
> The idea is that you can only modify the message when constructing it.
> but you are not limited to a single operation while constructing it.
> You do, however, have to start with an existing message unfortunately.
> so - one option is to map an existing message to your new message, even
> if the mapping does nothing essentially.
> then you can use a second shape in the message construction container to
> modify your message with the correct contents.
>
> another options is to start with an XmlDocument instantiation inside a
> message assignment shape. you can have code to load an Xml instance
> (hard coded, or from a file or any other source) to instantiate the
> XmlDocument with the correct contents.
>
> like with he map option you can then use whatever code you need to
> modify the loaded Xml as long as you do it within the message
> construction container.
>
> Hope this helps
>
> Yossi Dahan
>
> --
> Yossi Dahan
> www.sabratech.co.uk
>

Morten Moos

2006-01-27, 9:27 pm

Okay maybe i am not too handy in this:

I wrote this in an expression shape.
all i want to do is that the outcome should look like <book xmlns='test' and
the other attributes><xml></></>

Xmldoc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" + "<title>Pride
And Prejudice</title>" + "</book>");

varXMLattrib = Xmldoc.CreateAttribute("xmlns");

varXMLattrib.Value ="test";

Xmldoc.Attributes.Append(varXMLattrib);

it comes with an error that says object not set to an instance of an object.

could someone tell me how to write that code in an expression shape!

cheers!

Event Type: Error
Event Source: XLANG/s
Event Category: None
Event ID: 10034
Date: 1/27/2006
Time: 2:19:16 PM
User: N/A
Computer: CCOGCO-RKX8K1SM
Description:
Uncaught exception (see the 'inner exception' below) has suspended an
instance of service
'CCandCO_Invoiceprocessing.InvoiceProcessing(f2f00514-72fd-df92-d86e-f926ee9ef170)'.
The service instance will remain suspended until administratively resumed or
terminated.
If resumed the instance will continue from its last persisted state and may
re-throw the same unexpected exception.
InstanceId: be9c9ea0-dca1-4ad2-a110-88ff73a93bdc
Shape name: Expression_2
ShapeId: 11ecdb1d-e8ff-4ea6-b281-8619a8926473
Exception thrown from: segment 1, progress 23
Inner exception: Object reference not set to an instance of an object.

Exception type: NullReferenceException
Source: CCandCO_Invoiceprocessing
Target Site: Microsoft.XLANGs.Core.StopConditions
segment1(Microsoft.XLANGs.Core.StopConditions)
The following is a stack trace that identifies the location where the
exception occured

at CCandCO_Invoiceprocessing.InvoiceProcessing.segment1(StopConditions
stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
StopConditions stopCond, Exception& exp)



For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.


"mm" wrote:

> I am playing around with some orchestration fuzz.
> I cant understand why i cant change the message biztalk is sending out i
> have tried all sorts of things i.e:
> I initalize msgShipping which is the .net xmldocument with the
> customerparams (so i wont get i compiler error)
> afterwards i try to change it but nothing happens, the original message
> comes out (customerparams).
> It is like need some commit command or something what is going on.
>
> msgShipping = Customer_Param;
> msgShipping.RemoveAll();
> msgShipping.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
> "<title>Pride And Prejudice</title>" + "</book>");
>
> XmlNode = msgShipping.DocumentElement;
>
> //Create a new title element.
> XmlElement = msgShipping.CreateElement("title");
> XmlElement.InnerText="The Handmaid's Tale";
>
> //Replace the title element.
> XmlNode.ReplaceChild(XmlElement, XmlNode.FirstChild);
>
>

Yossi Dahan

2006-01-27, 9:27 pm

Morten Moos wrote:[vbcol=seagreen]
> Okay maybe i am not too handy in this:
>
> I wrote this in an expression shape.
> all i want to do is that the outcome should look like <book xmlns='test' and
> the other attributes><xml></></>
>
> Xmldoc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" + "<title>Pride
> And Prejudice</title>" + "</book>");
>
> varXMLattrib = Xmldoc.CreateAttribute("xmlns");
>
> varXMLattrib.Value ="test";
>
> Xmldoc.Attributes.Append(varXMLattrib);
>
> it comes with an error that says object not set to an instance of an object.
>
> could someone tell me how to write that code in an expression shape!
>
> cheers!
>
> Event Type: Error
> Event Source: XLANG/s
> Event Category: None
> Event ID: 10034
> Date: 1/27/2006
> Time: 2:19:16 PM
> User: N/A
> Computer: CCOGCO-RKX8K1SM
> Description:
> Uncaught exception (see the 'inner exception' below) has suspended an
> instance of service
> 'CCandCO_Invoiceprocessing.InvoiceProcessing(f2f00514-72fd-df92-d86e-f926ee9ef170)'.
> The service instance will remain suspended until administratively resumed or
> terminated.
> If resumed the instance will continue from its last persisted state and may
> re-throw the same unexpected exception.
> InstanceId: be9c9ea0-dca1-4ad2-a110-88ff73a93bdc
> Shape name: Expression_2
> ShapeId: 11ecdb1d-e8ff-4ea6-b281-8619a8926473
> Exception thrown from: segment 1, progress 23
> Inner exception: Object reference not set to an instance of an object.
>
> Exception type: NullReferenceException
> Source: CCandCO_Invoiceprocessing
> Target Site: Microsoft.XLANGs.Core.StopConditions
> segment1(Microsoft.XLANGs.Core.StopConditions)
> The following is a stack trace that identifies the location where the
> exception occured
>
> at CCandCO_Invoiceprocessing.InvoiceProcessing.segment1(StopConditions
> stopOn)
> at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
> StopConditions stopCond, Exception& exp)
>
>
>
> For more information, see Help and Support Center at
> http://go.microsoft.com/fwlink/events.asp.
>
>
> "mm" wrote:
>
>
From the error message it is not clear which statement cause the
problem, assuming that Expression2 is the shape in which you've placed
these lines and that there are no other statements I would add some
trace information to try and figure out which object is not being created.

One thing to check is whether you are using the default constructor of
XmlDocument when declaring XmlDoc.

--
Yossi Dahan
www.sabratech.co.uk
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com