WCF Errors with SOAP

I am confused about how I should return errors to the client using SOAP.

I have a wcf service, but I don’t know what technology the client uses, so I would like to stick to the SOAP specification.

As far as I read, fault messages seem like the best way to handle this.

I see that my service has many different possible failures:

  • Errors of null / expected data
  • Data format errors (i.e. db only allows 3 characters)
  • Errors of the data range "Client already exists", errors of type "Unable to process your request"

It would be right to create a new object for each of these errors and throw as such:

FaultException<NullFault>(nf);  
FaultException<InvalidDataFault>(idf);  
FaultException<ArguementFault>(af);  
FaultException<RangeFault>(rf);  

The client transfers large objects with many properties to almost every method (i.e. client, order, etc.).

?

.

IE:

[OperationContract]  
[FaultContract(typeof(NullFault))]  
[FaultContract(typeof(InvalidDataFault))]  
[FaultContract(typeof(ArguementFault))]  
[FaultContract(typeof(RangeFault))]  
void CreateCustomer(Customer customer);  

, GenericFault? -? ..: , , , ..?

, , -.

+3
1

- , , , . , , , , . , .

, NullFault RangeFault, , . , .

+2

Source: https://habr.com/ru/post/1707564/


All Articles