|
Home > Archive > BizTalk Server > February 2006 > Scope shape, catch exception, variables and messages
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 |
Scope shape, catch exception, variables and messages
|
|
| Chris C. 2006-02-10, 5:51 pm |
| I have three BizTalk orchestrations that I need to modify to catch BizTalk
generated errors. Currently, if one is generated besides a .NET code error,
the message within the orchestration is suspended and not recoverable and the
orchestration is terminated. I want to use a SCOPE shape with the CATCH
EXCEPTION exception handler. These orchestrations currently have
orchestration variables and messages that are used with expression code that
is written into the expression shapes. There are also receive and send
shapes with receive and send ports.
My question is what is the best way to handle any BizTalk generated error
within the orchestration. Should I put all of the orchestration shapes
within the SCOPE shape and then use a system.exception catch exception? Or,
should I put only the orchestration shapes inside the SCOPE shape except for
the receive and send ports and shapes? Also, if I put all of the existing
orchestration shapes inside the SCOPE shape, do I have to move all of the
orchestration variables and messages to the SCOPE shape variables and
messages section?
If I were to keep some of the shapes outside of the SCOPE shape that create
messages and use the variables, how do I send orchestration variables and
messages that are outside of the SCOPE shape to be accessible to the shapes
within the SCOPE shape to be used with expression shapes, etc.?
Chris
| |
| MaurÃcio Ritter 2006-02-12, 7:46 am |
| Hi Chris,
I think the best solution for you is to put all your shapes inside a scope
block use catch a System.Exception within it. The option of putting the
variables inside or outside the scope probably will not affect your solution.
If you wore using transactions and compensation then the variables inside the
scope would make sense, because they are all preserved at the end of the
transaction to allow compensation. Another thing, if you're not using
transaction, set your scope shape's Transaction property to None.
--
MaurÃ_cio Ritter
http://www.dotnetmaniacs.com.br
"Chris C." wrote:
> I have three BizTalk orchestrations that I need to modify to catch BizTalk
> generated errors. Currently, if one is generated besides a .NET code error,
> the message within the orchestration is suspended and not recoverable and the
> orchestration is terminated. I want to use a SCOPE shape with the CATCH
> EXCEPTION exception handler. These orchestrations currently have
> orchestration variables and messages that are used with expression code that
> is written into the expression shapes. There are also receive and send
> shapes with receive and send ports.
>
> My question is what is the best way to handle any BizTalk generated error
> within the orchestration. Should I put all of the orchestration shapes
> within the SCOPE shape and then use a system.exception catch exception? Or,
> should I put only the orchestration shapes inside the SCOPE shape except for
> the receive and send ports and shapes? Also, if I put all of the existing
> orchestration shapes inside the SCOPE shape, do I have to move all of the
> orchestration variables and messages to the SCOPE shape variables and
> messages section?
>
> If I were to keep some of the shapes outside of the SCOPE shape that create
> messages and use the variables, how do I send orchestration variables and
> messages that are outside of the SCOPE shape to be accessible to the shapes
> within the SCOPE shape to be used with expression shapes, etc.?
>
> Chris
| |
| Chris C. 2006-02-12, 5:55 pm |
| That is what I have done so far. The next thing is that the shapes within
the scope have expression shapes that have code in them that use variables
and messages. I left them to be global for now. The problem is that I need
to access these variables and messages within the catch exception block in an
expression shape. Leaving the variables and messages global, when I do a
solution build, I get errors saying that the variables and messages are
unassigned and I can't do a build.
How can I get access to those global variables and messages? I tried move
the variables and messages to be scope variables and messages and I still get
the same thing with the variables and messages used within the catch
exception block expression when I do the build.
How can I get get those variables and messages values to be used within the
catch exception block exception shape code?
Is there a way to leave the variables and messages global and have access to
them within the catch exception block expression shape code and also to the
scope shape?
Chris C.
"MaurÃ_cio Ritter" wrote:
[vbcol=seagreen]
> Hi Chris,
>
> I think the best solution for you is to put all your shapes inside a scope
> block use catch a System.Exception within it. The option of putting the
> variables inside or outside the scope probably will not affect your solution.
> If you wore using transactions and compensation then the variables inside the
> scope would make sense, because they are all preserved at the end of the
> transaction to allow compensation. Another thing, if you're not using
> transaction, set your scope shape's Transaction property to None.
>
> --
> MaurÃ_cio Ritter
> http://www.dotnetmaniacs.com.br
>
>
> "Chris C." wrote:
>
| |
| sanket.bakshi@gmail.com 2006-02-14, 2:48 am |
| Hi Chris,
You can assign default values to these variables.
This error would generally occur if you are trying to use a variable
but you have not assigned any value to it before using it.
Try using default values if you do not have assignments in a normal
flow.
You can assign default values with the "Initial Value" property of the
variable.
Regards,
Sanket
| |
| Chris C. 2006-02-14, 5:51 pm |
| That is a good idea. Thanks.
But, that does not answer my question. Can I access the actual value of a
global orchestration variable or global message that may have data in it that
was assigned within the scope shape from within the catch exception block?
Chris
"sanket.bakshi@gmail.com" wrote:
> Hi Chris,
> You can assign default values to these variables.
> This error would generally occur if you are trying to use a variable
> but you have not assigned any value to it before using it.
>
> Try using default values if you do not have assignments in a normal
> flow.
> You can assign default values with the "Initial Value" property of the
> variable.
>
> Regards,
> Sanket
>
>
| |
| Chris C. 2006-02-17, 10:50 pm |
| In addition...
The original orchestrations are atomic with global variables and messages.
I need to put all of the original orchestration shapes into a scope. I need
to add a catch exception block to this scope to catch any uncaught BizTalk
generated exceptions. Within this catch exception, I want to add a
expression shape that will capture the exception error, capture the message
itself (either the original or the one being altered in the orchestration
shapes, whichever exists at the time of the exception)and send to an existing
MSMQ error queue, write the error to the log to be seen in the event viewer.
Existing .NET code exists in the original orchestration shapes that get
information from the message, ie GUID value. Other existing code in the
orchestration shapes include .NET code that contain logic that will write
information to the event log already. I also want to put the message into a
directory to save the message. Logic also exists to also put the message to
an error queue in the original orchestration shapes. These original
orchestration shapes use global variables and messages. Now, these original
orchestration shapes are within the scope shape. I left the variables and
messages global. I had to make the orchestration long running and the scope
shape 'none' for the transaction type. I want to copy some of the existing
code that is now in the scope shape into the catch exception block expression
shape, leaving the variables and messages global. Then next within the catch
exception block, I want to put a terminate shape that will have a message to
go to the log with the actual exception message error. The problem is that
the when I build the solution, I get errors saying that the variables and
messages being accessed within the catch exception block shapes are not
initialized and will not build. I tried to put the variables and messages to
be within the scope shape variable and message area and still have the same
build problem.
I found an article within Google for a way to get around it but don't
understand exactly. It says to put an inner scope in the existing scope and
make it atomic. Then to use a decision shape to sheck if the atomic scope
is successful and to leave the catch exception block on the outer scope like
it is. This should allow the build to occur. I don't quite understand where
to put the decision shape nor quite understand what the solution is. Here is
a part of the article:
http://www.traceofthought.net/defau...2004-04-21.aspx
There is a somewhat similar case that is described briefly in the BizTalk
documentation. Imagine we wish to make reference to a message or variable in
our 'catch' block that was initialized within the associated scope. In this
case, the
orchestration compiler will assume that we might not have gotten around to
initializing that variable/message prior to the exception being thrown -
and a
compiler error will be generated as a result: error X2109: use of
unassigned local
variable 'Variable_Blah'
In this case, we can wrap the portion of the scope's work that is
responsible for
initializing the variable/message of interest in an (additional)
transactional scope
(i.e. "Scope_InitWork"), and we can use a Decide shape with an expression
such
as "!succeeded(Transaction_InitWork)" in the rule branch. This will allow
the
orchestration to compile…
Wow! One might start to agree with Charles' boss (hyperlink to Charles'
boss is
http://geekswithblogs.net/cyoung/ar...04/15/3927.aspx).
I really would like to copy the existing code within the expression shapes
that are now within the new scope shape within the new scope shape's catch
exception block expression shape and access the same orchestration variables
and messages (that are currently global).
Chris C.
"Chris C." wrote:
[vbcol=seagreen]
> That is a good idea. Thanks.
>
> But, that does not answer my question. Can I access the actual value of a
> global orchestration variable or global message that may have data in it that
> was assigned within the scope shape from within the catch exception block?
>
> Chris
>
> "sanket.bakshi@gmail.com" wrote:
>
|
|
|
|
|