BizTalk Server Orchestration - creating BizTalk exceptions on purpose

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > February 2006 > creating BizTalk exceptions on purpose





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 creating BizTalk exceptions on purpose
Chris C.

2006-02-22, 2:47 am

I have updated some BizTalk orchestrations that are atomic. I have included
a non-transactional scope with a catch exception block for system.exception
in each orchestration. I have put all of the original orchestration shapes
within the scope block. The BizTalk orchestrations would occassionally take
unhandled exceptions that are hard to recreate.

Now, the question is. How can I purposely create an unhandled BizTalk
exception to test the new catch exception block for the system.exception?

Should I also include another catch exception block for a general exception?

Chris C.

BA

2006-02-22, 2:47 am



You want to create an exception to test the catch exception block?

What I do to test the exception block is create a variable with data type
int (intX) with a default value of 0, then in an expression shape type intX
= 1/intX.

This will create a divide by 0 exception and trigger whatever you have in
your exception block.

Hope this helps.

BA
http://biztalkia.blogspot.com/


> I have updated some BizTalk orchestrations that are atomic. I have
> included a non-transactional scope with a catch exception block for
> system.exception in each orchestration. I have put all of the
> original orchestration shapes within the scope block. The BizTalk
> orchestrations would occassionally take unhandled exceptions that are
> hard to recreate.
>
> Now, the question is. How can I purposely create an unhandled BizTalk
> exception to test the new catch exception block for the
> system.exception?
>
> Should I also include another catch exception block for a general
> exception?
>
> Chris C.
>



Chris C.

2006-02-22, 2:47 am

Great, that will help alot. I was hoping to find a way so I would not have
to change the orchestration to add a shape and then have to rebuild,
redeploy,
etc. And, then have to back in and take that stuff out again. Your way I
ended up doing anyway. Is there a way to stop a service or something so I
would not have to change the orchestration? I have tried to disable receive
ports, stop send ports, rename receive and send port associated physical
location paths, and a whole bunch more with no luck.

Should I put in another catch exception block to catch any general
exceptions, besides the system.exception?

Chris C.

"BA" wrote:

>
>
> You want to create an exception to test the catch exception block?
>
> What I do to test the exception block is create a variable with data type
> int (intX) with a default value of 0, then in an expression shape type intX
> = 1/intX.
>
> This will create a divide by 0 exception and trigger whatever you have in
> your exception block.
>
> Hope this helps.
>
> BA
> http://biztalkia.blogspot.com/
>
>
>
>
>

BA

2006-02-22, 2:47 am

Hey,

By adding a divide by 0, all you have to do is rebuild the orchestration,
re-gac the dll and stop/start your host. You shouldnt need to re-deploy.

Here is a registry key to make gac-ing easier: http://biztalkia.blogspot.com/2005/...dll-to-gac.html

Here is a tool to make stopping and starting hosts easier: http://biztalkia.blogspot.com/2006/...nager-2004.html

I dont know of a way to do it without changing your orchestration. Maybe
have a 0 or 1 in a field in your incoming xml so you can trigger the error
that way? Instead of intX = 1/intX you'd have intX = 1/xmlField

The general exception catches system.exception as well as exceptions generated
from any other class. Its more global but you dont have access to the exception,
its a trade off. Read here for more detail: http://geekswithblogs.net/cyoung/ar...04/26/4345.aspx

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

[vbcol=seagreen]
> Great, that will help alot. I was hoping to find a way so I would not
> have
> to change the orchestration to add a shape and then have to rebuild,
> redeploy,
> etc. And, then have to back in and take that stuff out again. Your
> way I
> ended up doing anyway. Is there a way to stop a service or something
> so I
> would not have to change the orchestration? I have tried to disable
> receive
> ports, stop send ports, rename receive and send port associated
> physical
> location paths, and a whole bunch more with no luck.
> Should I put in another catch exception block to catch any general
> exceptions, besides the system.exception?
>
> Chris C.
>
> "BA" wrote:
>


Chris C.

2006-02-22, 5:57 pm

Thanks. I read CYOUNG entry and it states that general exception does not
catch system exceptions.

Is there a way to do a search on the CYOUNG blog?

Where are there good 'how to' articles on Biztalk orchestrations and
exceptions besides the MSDN library that is of some use but not enough.

Our orchestrations have .NET components that are like utilities that get
info from the XML message and use global orchestration variables and
messages. In my catch exception, I could only write to the event log and
terminate the BizTalk orchestration. I really wanted to be able to access
those .NET components, the global orchestration variables and messages within
the scope catch exception block. This would allow me to put some of the XML
message information into the event log. I wanted to be able to suspend the
BizTalk orchestration and write the XML message to an MSMQ error queue. I
could not access any of the .NET components, global orchestration variables
or messages within the scope catch exception block. Is there a way to
accomplish this last wish?

Chris C.

"BA" wrote:

> Hey,
>
> By adding a divide by 0, all you have to do is rebuild the orchestration,
> re-gac the dll and stop/start your host. You shouldnt need to re-deploy.
>
> Here is a registry key to make gac-ing easier: http://biztalkia.blogspot.com/2005/...dll-to-gac.html
>
> Here is a tool to make stopping and starting hosts easier: http://biztalkia.blogspot.com/2006/...nager-2004.html
>
> I dont know of a way to do it without changing your orchestration. Maybe
> have a 0 or 1 in a field in your incoming xml so you can trigger the error
> that way? Instead of intX = 1/intX you'd have intX = 1/xmlField
>
> The general exception catches system.exception as well as exceptions generated
> from any other class. Its more global but you dont have access to the exception,
> its a trade off. Read here for more detail: http://geekswithblogs.net/cyoung/ar...04/26/4345.aspx
>
> Cheers,
> BA
> http://biztalkia.blogspot.com
>
>
>
>
>

BA

2006-02-22, 5:57 pm

Chris,

I dont think there is a search. Do a site specific search with google:

http://www.google.com/search?hl=en&...gs.net%2Fcyoung

I recall a whitepaper that had exception handling info in it from MSoft but
I cant locate it at the moment. Anyone know which article I am talking about?

General exception catches all exceptions, what you dont get is access to
the exception object. You need to either catch a specific exception or the
system.exception -there you have more control.

You should be able to do everything you mentioned in your post in your exception
handler.

Another thing I want to point out, you mentioned atomic scope in your previous
message, maybe thats a misprint since you dont get an exception handler within
an atomic scope, you get a compensation block. If you are using atomic scopes,
I rarely use them with compensation, so I am not too clear on the capabilities.
Anyone else have more experience here?


BA
http://biztalkia.blogspot.com


[vbcol=seagreen]
> Thanks. I read CYOUNG entry and it states that general exception does
> not catch system exceptions.
>
> Is there a way to do a search on the CYOUNG blog?
>
> Where are there good 'how to' articles on Biztalk orchestrations and
> exceptions besides the MSDN library that is of some use but not
> enough.
>
> Our orchestrations have .NET components that are like utilities that
> get info from the XML message and use global orchestration variables
> and messages. In my catch exception, I could only write to the event
> log and terminate the BizTalk orchestration. I really wanted to be
> able to access those .NET components, the global orchestration
> variables and messages within the scope catch exception block. This
> would allow me to put some of the XML message information into the
> event log. I wanted to be able to suspend the BizTalk orchestration
> and write the XML message to an MSMQ error queue. I could not access
> any of the .NET components, global orchestration variables or messages
> within the scope catch exception block. Is there a way to accomplish
> this last wish?
>
> Chris C.
>
> "BA" wrote:
>


Chris C.

2006-02-22, 5:57 pm

I meant the scenario to be the orchestrations are atomic transactions, each
having one non-transactional scope block with one catch exception block
checking for system.exeption. All of the original orchestration shapes are
within the non-transactional scope block.

My biggest problem and still is that I can't access the orchestration global
variables and messages within the catch exception block that goes with the
non-transactional scope and atomic transaction orchestration. I get the
error that they are not initialized and can't do a build. I would like to
get the values of the orchestration global variables and the XML message at
the time the exception occurs and that information into the event log. I
have been told that once the exception occurs that the information within the
orchestration global variables and message are cleared out. There has to be
some way to preserve those values so they can be used within the catch
exception block shapes, ie expression shapes. I also need to save and have
access to the message (the one defined in the orchestration message area or
the message area that is assigned to an xml object document variable that is
of the System.Xml.XmlDocument and is used within the orchestration) being
processed at the time of the exception. In the catch exception block, I
can't access those areas and can't do a build because the variables are not
initialized. There has to be some way to get access to these areas. I would
like to send the message being processed at the time of the exception to an
MSMQ error queue and suspend the BizTalk orchestration rather than just
writing some basic error information to the event log and terminating the
orchestration.

I did find some information on preserving the variable data within the scope
block but did not understand how it would work. I can't find anything or
examples in Google or MSDN or MS newsgroups on how to do this. I am sure
someone has done this. Specifically, is it possible to send the message
being processed at the time of the exception to an MSMQ error queue in the
catch block? I also would like to have access to the .NET components and
their variables values within the catch exception block.

Chris C.

Chris C.


"BA" wrote:

> Chris,
>
> I dont think there is a search. Do a site specific search with google:
>
> http://www.google.com/search?hl=en&...gs.net%2Fcyoung
>
> I recall a whitepaper that had exception handling info in it from MSoft but
> I cant locate it at the moment. Anyone know which article I am talking about?
>
> General exception catches all exceptions, what you dont get is access to
> the exception object. You need to either catch a specific exception or the
> system.exception -there you have more control.
>
> You should be able to do everything you mentioned in your post in your exception
> handler.
>
> Another thing I want to point out, you mentioned atomic scope in your previous
> message, maybe thats a misprint since you dont get an exception handler within
> an atomic scope, you get a compensation block. If you are using atomic scopes,
> I rarely use them with compensation, so I am not too clear on the capabilities.
> Anyone else have more experience here?
>
>
> BA
> http://biztalkia.blogspot.com
>
>
>
>
>
>

BA

2006-02-23, 2:53 am



I suspect, although I am not sure, that your problem lies with the atomic
transaction. When an atomic transaction fails it does a roll back. You
may be losing everything because of that. Again, I have no history with
setting up an orchestration the way you are to know for sure.

My suggestion would be to peel back all the transactions and add one layer
at a time until it breaks. That way you can at least isolate the problem.

Do you use DebugView? Once you get it up and running it will help you track
the orchestrations progress. You can download it from SysInternals.

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



[vbcol=seagreen]
> I meant the scenario to be the orchestrations are atomic transactions,
> each having one non-transactional scope block with one catch exception
> block checking for system.exeption. All of the original orchestration
> shapes are within the non-transactional scope block.
>
> My biggest problem and still is that I can't access the orchestration
> global variables and messages within the catch exception block that
> goes with the non-transactional scope and atomic transaction
> orchestration. I get the error that they are not initialized and
> can't do a build. I would like to get the values of the orchestration
> global variables and the XML message at the time the exception occurs
> and that information into the event log. I have been told that once
> the exception occurs that the information within the orchestration
> global variables and message are cleared out. There has to be some
> way to preserve those values so they can be used within the catch
> exception block shapes, ie expression shapes. I also need to save and
> have access to the message (the one defined in the orchestration
> message area or the message area that is assigned to an xml object
> document variable that is of the System.Xml.XmlDocument and is used
> within the orchestration) being processed at the time of the
> exception. In the catch exception block, I can't access those areas
> and can't do a build because the variables are not initialized. There
> has to be some way to get access to these areas. I would like to send
> the message being processed at the time of the exception to an MSMQ
> error queue and suspend the BizTalk orchestration rather than just
> writing some basic error information to the event log and terminating
> the orchestration.
>
> I did find some information on preserving the variable data within the
> scope block but did not understand how it would work. I can't find
> anything or examples in Google or MSDN or MS newsgroups on how to do
> this. I am sure someone has done this. Specifically, is it possible
> to send the message being processed at the time of the exception to an
> MSMQ error queue in the catch block? I also would like to have access
> to the .NET components and their variables values within the catch
> exception block.
>
> Chris C.
>
> Chris C.
>
> "BA" wrote:
>


Chris C.

2006-02-26, 10:48 am

I need to have the orchestration as an atomic transaction because there are
some global orchestration variables that are not serialized - XMLnode and
XMLdocument that are used within .NET components. When I do a build for
other transaction types, I get an error saying non-serialized variables must
be defined within an atomic transaction or service.

Chris C.

"BA" wrote:

>
>
> I suspect, although I am not sure, that your problem lies with the atomic
> transaction. When an atomic transaction fails it does a roll back. You
> may be losing everything because of that. Again, I have no history with
> setting up an orchestration the way you are to know for sure.
>
> My suggestion would be to peel back all the transactions and add one layer
> at a time until it breaks. That way you can at least isolate the problem.
>
> Do you use DebugView? Once you get it up and running it will help you track
> the orchestrations progress. You can download it from SysInternals.
>
> Cheers,
> BA
> http://biztalkia.blogspot.com
>
>
>
>
>
>
>

BA

2006-02-26, 10:48 am

Xml node requires an atomic scope, but xml document can definitely be used
outside an atomic scope.

You may consider using C# inside a static method which does not require serialization
and do whatever work you are doing with the xml node there. Or consider
an atomic scope only around the areas that using the xml node --but be weary,
this adds a persistence point.


BA
http://biztalkia.blogspot.com
[vbcol=seagreen]
> I need to have the orchestration as an atomic transaction because
> there are some global orchestration variables that are not serialized
> - XMLnode and XMLdocument that are used within .NET components. When
> I do a build for other transaction types, I get an error saying
> non-serialized variables must be defined within an atomic transaction
> or service.
>
> Chris C.
>
> "BA" wrote:
>


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com