Hello, and thanks for any assistance.
I'm confused on how I should return errors to a client using SOAP.
I have a wcf service, but I'm not sure what technology the client is using, so I'd like to stick to the SOAP specification.
As far as I've read, Fault messages seem to be the best way to handle this.
I can see my service having many different possible faults:
Null\expected data errors Data format errors (ie: db only allows 3 chars) Data Range errors "Customer already exists", "Unable to process your request" type errors
Would it be proper to create a new object for each of those faults?
and throw as such:
FaultException(nf);
FaultException(idf);
FaultException(af);
FaultException(rf);
The client is passing in big objects with many properties to practically every method (ie: Customer, Order, ext.)
Would this be the proper way of handling errors and sending back to the client?
It seems out of place to have to add each fault to the attributes above the method?
IE:
[OperationContract]
[FaultContract(typeof(NullFault))]
[FaultContract(typeof(InvalidDataFault))]
[FaultContract(typeof(ArguementFault))]
[FaultContract(typeof(RangeFault))]
void CreateCustomer(Customer customer);
(also, what about a GenericFault? How would you handle business rule errors? ie: Customer already exists, to many line items, don't ship to that area, payment method not accepted, ext.?)
Please let me know if this method is proper or if there is another excepted solution and how you would handle the 'business rule' situation.
Thanks, Steven