Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / July 2005

Tip: Looking for answers? Try searching our database.

Catching errors in webservices

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
phlakie - 18 Jul 2005 14:21 GMT
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.
Hammad Rajjoub - 19 Jul 2005 06:55 GMT
Hello,

You should use Exception handling to cater this scenario.

On a side not i would suggest you not to write your business logic (stored
proc calls etc) in ur web method. Rather use web methods as facade over your
business logic.

regards,

> 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.
phlakie - 19 Jul 2005 09:33 GMT
Thanks so much for your help. Taking up your side note. Can you explain
better what you mean using web methods as facade over my business logic. I'm
new to both web services and enterprise application programming. Thanx.

> Hello,
>
[quoted text clipped - 9 lines]
> > either returns an error or an integer. How do I catch this error in the web
> > method? Thanks.
Steve - 21 Jul 2005 04:46 GMT
I believe what Hammad means is that you create a class library for example,
with all of your business logic in it, reference this in your web service and
make the calls through it.

So you'd have something like this in your WS...

..............................................
private MyBusinessComponent oBusiness ;

public MyWebService
{
      oBusiness = new MyBusinessComponent() ;
}

[WebMethod]
public bool SaveBusinessObject(object oObject)
{
    oBusiness.SaveBusinessObject(oObject) ;
}
..............................................

rather than...

..............................................
private MyBusinessComponent oBusiness ;

public MyWebService
{
}

[WebMethod]
public bool SaveBusinessObject(object oObject)
{
   ValidateObject() ;
   MySQLCommand.Execute(sqlString) ;
}
..............................................

> Thanks so much for your help. Taking up your side note. Can you explain
> better what you mean using web methods as facade over my business logic. I'm
[quoted text clipped - 13 lines]
> > > either returns an error or an integer. How do I catch this error in the web
> > > method? Thanks.
Hammad Rajjoub - 21 Jul 2005 06:37 GMT
Yes Steve you are right. Phlakie i would suggest you to read "Enterprise
Solution Patterns" available at msdn.com/patterns web site. Following are a
couple of resources that should help you out with your design and
imeplementation.

Facade Pattern:
http://en.wikipedia.org/wiki/Facade_pattern

Web Service Facade Solution
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/WSFa
cadeLegacyApp.asp


best regards,
Hammad

> I believe what Hammad means is that you create a class library for example,
> with all of your business logic in it, reference this in your web service and
[quoted text clipped - 51 lines]
> > > > either returns an error or an integer. How do I catch this error in the web
> > > > method? Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.