web services - wcf architecture design. re: return values -
Hello and thanks for your feedback.
I am creating a webservice. This WebSizer will accept a customer and customer account with some other related items and attributes and
When the webservice receives the request, then I I try to process.
If there is no error, then I just return. If there is an error, then I throw it.
I am thinking that this is the best way, or if I should modify my design so that I can return a hair as a response, or even make a reaction object, which may include the original request object Plus there is a condition and if error, a list of errors (i.e.: missing fields, invalid fields, ext).
Which return method will you include in your design? 1) If there is no error, then return the error error 2) Bull success 3) Reaction object (original request object containing and detailed results)?
Thanks for any suggestions Steven
I would say that this 'error' Depends on what is expected if the error is related to accreditation but is expected to occur in normal events, then user authentication is being given to user user authentication for validation, then returns a value value which results in the result (Success, Failure, etc.) Does okay However, if the error is due to the input that should not occur in the normal state of the event, then I would suggest that you throw a mistake by operating the service. Throwing a mistake indicates that the client app is in error and provided the input that the service does not know how to handle it. You can register specific mistake contracts with the WCF service operation so that a customer app knows that the operation can throw one of the many flaws in special circumstances. The client application should provide an exception handler for these defects and take action if someone is thrown, otherwise it will end in an unexpected way.
As a basic rule of thumb, I would say that throwing errors in exceptional circumstances; Where the customer has provided the input that does not expect service to be received. If the client has provided incorrect information but has been prommitted to handle the service operation, then return a status code or notice in the response message.
Comments
Post a Comment