BizTalk Server General - simple xlang question

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > January 2005 > simple xlang question





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 simple xlang question
Thomas

2005-01-23, 7:46 am

Hi,

just a simple question concerning xlang.
I don´t really understand how to create a new message instance with the
expression-shape. If I simply put the assign-shape in a create-message-shape
and edit a few values (for example MyMessageInstance.myValue = "Hello
world";) the compiler tells me, that the instance has not been properly
initialized. Simply put a MyMessageInstance = null; into the expression helps
for the compiler but then I get an exception while running my orchestration.
So I always put an transform-shape before the assign-instance. That works,
but it cannot be the solution. Can someone tell me how to properly initialize
the instances without transformation? I guess this is also the only way to
stay BPEL-compatible. Is this true?

Thanks for answer
Thomas
Nabeel Prior

2005-01-23, 5:49 pm

I am not sure about the BPEL-compliance impact on the way this was
implemented, but there are really only 2 ways that I know of to initialise a
new message:
1. A map, as you have used.
2. Assignment, where you have to actually give the message xml content that
it can use to validate against its schema. At the same time, you can not
assign a value to a promoted / distinguished property if that field does not
exist in the xml. So, you either have to assign one message to an already
existing instance of a message with the same schema (message1 = message2),
and then assign property fields, OR you have to assign it XML. To do this
you have to create an XmlDocument variable, use the LoadXML function, and
then assign the variable to the message (message1 = xmlDocument). Once this
is done, and assuming you included the promoted fields in your xml, you can
assign values to the promoted property fields. This is not as elegant as it
should be, and hopefully it is something that will be remedied as MS
continues to develop.

--

Kind Regards,

Nabeel Prior
Web: http://www.brainjar.co.za
Blog: http://www.brainjar.co.za/blog.aspx


"Thomas" <Thomas@discussions.microsoft.com> wrote in message
news:AE9965B1-E0CE-4F33-A913-DF3791DA4805@microsoft.com...
> Hi,
>
> just a simple question concerning xlang.
> I don´t really understand how to create a new message instance with the
> expression-shape. If I simply put the assign-shape in a
> create-message-shape
> and edit a few values (for example MyMessageInstance.myValue = "Hello
> world";) the compiler tells me, that the instance has not been properly
> initialized. Simply put a MyMessageInstance = null; into the expression
> helps
> for the compiler but then I get an exception while running my
> orchestration.
> So I always put an transform-shape before the assign-instance. That works,
> but it cannot be the solution. Can someone tell me how to properly
> initialize
> the instances without transformation? I guess this is also the only way to
> stay BPEL-compatible. Is this true?
>
> Thanks for answer
> Thomas



Thomas

2005-01-23, 5:49 pm

Nabeel,

thank you very much for your answer.
Can you give me an example, how you´d do it?
I played around a little bit with the LoadXML-Function, but I´m not sure if
I did the right things.

Thank you
Thomas

"Nabeel Prior" wrote:

> I am not sure about the BPEL-compliance impact on the way this was
> implemented, but there are really only 2 ways that I know of to initialise a
> new message:
> 1. A map, as you have used.
> 2. Assignment, where you have to actually give the message xml content that
> it can use to validate against its schema. At the same time, you can not
> assign a value to a promoted / distinguished property if that field does not
> exist in the xml. So, you either have to assign one message to an already
> existing instance of a message with the same schema (message1 = message2),
> and then assign property fields, OR you have to assign it XML. To do this
> you have to create an XmlDocument variable, use the LoadXML function, and
> then assign the variable to the message (message1 = xmlDocument). Once this
> is done, and assuming you included the promoted fields in your xml, you can
> assign values to the promoted property fields. This is not as elegant as it
> should be, and hopefully it is something that will be remedied as MS
> continues to develop.
>
> --
>
> Kind Regards,
>
> Nabeel Prior
> Web: http://www.brainjar.co.za
> Blog: http://www.brainjar.co.za/blog.aspx
>
>
> "Thomas" <Thomas@discussions.microsoft.com> wrote in message
> news:AE9965B1-E0CE-4F33-A913-DF3791DA4805@microsoft.com...
>
>
>

Ashish Shukla

2005-01-24, 2:47 am

Hi Thomas,

Say you have a schema like this

ReqRoot
|
--GetAuthorData
|
--AuthorPrimaryKey

This schema is to call GetAuthorData stored procedure and you have to pass
primary key of the author as the parameter to the stored procedure. In the
above schema "AuthorPrimaryKey" is an attribute of "GetAuthorData" node. Lets
also assume that namespace of the schema is "http://nspSampleSchema".
Following are the steps to build request message manually.

lobjXML = new XMLDocument();

lstrPrimaryKey = "Auth001";

lobjXML.LoadXML("<ns0:ReqRoot
xmlns:ns0=\"http://nspSampleSchema\"><ns0:GetAuthorData AuthorPrimaryKey=\""
+ lstrPrimaryKey + "\"></ns0:GetAuthorData></ns0:ReqRoot>");

msgReqMessage = lobjXML;

I hope this is usefull.

Thanks
Ashish Shukla




"Thomas" wrote:
[vbcol=seagreen]
> Nabeel,
>
> thank you very much for your answer.
> Can you give me an example, how you´d do it?
> I played around a little bit with the LoadXML-Function, but I´m not sure if
> I did the right things.
>
> Thank you
> Thomas
>
> "Nabeel Prior" wrote:
>
Ivan Jocic

2005-01-24, 5:50 pm

Hi thomas,

Can't you use transform shape where transforming from "Request" message
to the destination one? This way even when you change your destination
XSD you do not have to review your code (if using LoadXML).

Ivan

Thomas

2005-01-26, 7:47 am

unfortunately not, because you have to have an initialized message as
"request".
What I did is to use any initialized message_instance and don´t do anything.
But this is a really "dirty" way. And it is not BPEL-compatible, because of
the transform-shape.

thomas

"Ivan Jocic" wrote:

> Hi thomas,
>
> Can't you use transform shape where transforming from "Request" message
> to the destination one? This way even when you change your destination
> XSD you do not have to review your code (if using LoadXML).
>
> Ivan
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com