Throw a SoapException or Return a string?

G

Greg Robinson

Our web service uses ComInterop to interact with a FoxPro COM dll. The COM
dll assigns 0 - 20 "Error Codes" to a public property at the end of it's
method. If the call to the COM dll was successfull, the COM dll assigns 0 to
the public property. If there was an error, depending on the error, the COM
dll assigns an integer between 1 and 20 to the public property. So I have
code that checks the error number property after the call to the COM dll.

The web method signature looks like this:

Public Function PostProduct() As String

I use to throw a soap exception if the error code was not 0. Non .Net
clients had problems with this (I cannot recall why, this was written 3
years ago). The web method returns a string so I now ( modified 6 months
ago) simply return a string with something like "ERROR CODE = 10".

A new client (web app written with PERL I think) has an issue with this so
it's got me thinking. What's the best practice here? Throw a soapexception
and put the error code in the exception details or return a string with the
error code?

Or, does it really matter?



Greg Robinson

Custom Data Systems, Inc.

www.cds-am.net
 
E

erymuzuan

Well. I would normally recommends using Soap fault for web services
error, or policy violations, but for expeced business funtion error,
returning a meaning full error code is more appropriate, and i possible
use XmlElement to describe the business error

regards
erymuzuan mustapa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top