473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Catching erros in web services

I have a try catch block in a web service that executes ADO.NET code that
interfaces with an Oracle database. In addition, I have a try catch block in
the client around the call to the web service. I am having an issue catching
the Oracle error and passing the error info to the client. When stepping
through the debugger, I have noticed that as soon as I step into the catch
block on the web service, the debugger jumps to the catch block on the client
and the client catch block is what is run. The issue is that code in the
catch block in the webservice does not execute. This causes the records
involved with the transacation to remain locked. Also, the Exception object
on the client contains SOAP error details, where as the Exception object on
the web service contains the Oracle error. I would like to access the
Exception object on the web service to be able to report the Oracle error
which is much more beneficial in reporting what the problem is. Does anyone
know what I need to do to access the Exception object info on the web
service?

I am using a C# Windows application as the test client. The web service was
written in C#. I am developing the web service on my localhost.

Below is sample code related to what I am currently doing:

Client Code:

try
{
errorMessage = webService1.DoSomething( param1 );
}

catch ( Exception ex ) // This exception obj contains SOAP error details
{
MessageBox.Show(errorMessage + " " + ex.ToString());
return;
}

Web Service Code:

try
{
dataAdaptor1.Update(ds);
}

catch (Exception ex ) // This exception object contains the ADO/Oracle
error details
{
errorMessage = ex.ToString()); // As soon as I step here, the
debugger
// jumps to the
catch block in the client and
// none of this code
is executed causing the
// record in the
database to remain locked.
trans.Rollback();
dataAdaptor1.UpdateCommand.Connection.Close();
return errorMessage;
}
}

Nov 23 '05 #1
2 4395
Please disregard this question.

I had a syntactical issue with a string.Format() statement that was the
first statement in the web service catch block. This made it appear to me
that the .net framework was automatically jumping to the client catch block
when in fact it was a second exception within the web service catch block
that was being thrown.

Problem solved!

"Geoff O" wrote:
I have a try catch block in a web service that executes ADO.NET code that
interfaces with an Oracle database. In addition, I have a try catch block in
the client around the call to the web service. I am having an issue catching
the Oracle error and passing the error info to the client. When stepping
through the debugger, I have noticed that as soon as I step into the catch
block on the web service, the debugger jumps to the catch block on the client
and the client catch block is what is run. The issue is that code in the
catch block in the webservice does not execute. This causes the records
involved with the transacation to remain locked. Also, the Exception object
on the client contains SOAP error details, where as the Exception object on
the web service contains the Oracle error. I would like to access the
Exception object on the web service to be able to report the Oracle error
which is much more beneficial in reporting what the problem is. Does anyone
know what I need to do to access the Exception object info on the web
service?

I am using a C# Windows application as the test client. The web service was
written in C#. I am developing the web service on my localhost.

Below is sample code related to what I am currently doing:

Client Code:

try
{
errorMessage = webService1.DoSomething( param1 );
}

catch ( Exception ex ) // This exception obj contains SOAP error details
{
MessageBox.Show(errorMessage + " " + ex.ToString());
return;
}

Web Service Code:

try
{
dataAdaptor1.Update(ds);
}

catch (Exception ex ) // This exception object contains the ADO/Oracle
error details
{
errorMessage = ex.ToString()); // As soon as I step here, the
debugger
// jumps to the
catch block in the client and
// none of this code
is executed causing the
// record in the
database to remain locked.
trans.Rollback();
dataAdaptor1.UpdateCommand.Connection.Close();
return errorMessage;
}
}

Nov 23 '05 #2
Please disregard this question.

I had a syntactical issue with a string.Format() statement that was the
first statement in the web service catch block. This made it appear to me
that the .net framework was automatically jumping to the client catch block
when in fact it was a second exception within the web service catch block
that was being thrown.

Problem solved!

"Geoff O" wrote:
I have a try catch block in a web service that executes ADO.NET code that
interfaces with an Oracle database. In addition, I have a try catch block in
the client around the call to the web service. I am having an issue catching
the Oracle error and passing the error info to the client. When stepping
through the debugger, I have noticed that as soon as I step into the catch
block on the web service, the debugger jumps to the catch block on the client
and the client catch block is what is run. The issue is that code in the
catch block in the webservice does not execute. This causes the records
involved with the transacation to remain locked. Also, the Exception object
on the client contains SOAP error details, where as the Exception object on
the web service contains the Oracle error. I would like to access the
Exception object on the web service to be able to report the Oracle error
which is much more beneficial in reporting what the problem is. Does anyone
know what I need to do to access the Exception object info on the web
service?

I am using a C# Windows application as the test client. The web service was
written in C#. I am developing the web service on my localhost.

Below is sample code related to what I am currently doing:

Client Code:

try
{
errorMessage = webService1.DoSomething( param1 );
}

catch ( Exception ex ) // This exception obj contains SOAP error details
{
MessageBox.Show(errorMessage + " " + ex.ToString());
return;
}

Web Service Code:

try
{
dataAdaptor1.Update(ds);
}

catch (Exception ex ) // This exception object contains the ADO/Oracle
error details
{
errorMessage = ex.ToString()); // As soon as I step here, the
debugger
// jumps to the
catch block in the client and
// none of this code
is executed causing the
// record in the
database to remain locked.
trans.Rollback();
dataAdaptor1.UpdateCommand.Connection.Close();
return errorMessage;
}
}

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Reinhard Abel | last post by:
I have an old C-Program written with Borland 2.0. Now I like to do some changes, but I get lot of syntax Erros with my new computer. When I use the old mashine ( 286 ) it works perfectly but I can...
7
by: cmay | last post by:
FxCop complains every time I catch System.Exception. I don't see the value in trying to catch every possible exception type (or even figuring out what exceptions can be caught) by a given block...
1
by: Michiel | last post by:
Hello, I want to see if the driver of my capture card sends messages when it recieves video input. In order to do this, I built a Windows Service, which contains a message loop. How can I...
12
by: Vasco Lohrenscheit | last post by:
Hi, I have a Problem with unmanaged exception. In the debug build it works fine to catch unmanaged c++ exceptions from other dlls with //managed code: try { //the form loads unmanaged dlls...
2
by: cesark | last post by:
I have calling a stored procedure that returns two values, and I want to catch these values and to store them into a variable. Here is a piece of my SP inside SQL Server that shows the returned...
0
by: Geoff O | last post by:
I have a try catch block in a web service that executes ADO.NET code that interfaces with an Oracle database. In addition, I have a try catch block in the client around the call to the web...
4
by: phlakie | last post by:
I made a call to a stored procedure in a web method. The stored procedure either returns an error or an integer. How do I catch this error in the web method? Thanks.
7
by: Derek Schuff | last post by:
I'm sorry if this is a FAQ or on an easily-accesible "RTFM" style page, but i couldnt find it. I have some code like this: for line in f: toks = line.split() try: if int(toks,16) ==...
2
by: Eric Lilja | last post by:
Hello, consider this complete program: #include <iostream> #include <string> using std::cout; using std::endl; using std::string; class Hanna {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.