Oscar Gomez
Oscar Gomez

Reputation: 18488

Web Service retrieving and parsing XML file - how to handle errors?

I have a Web Service that retrieves and XML File, parses it and sends back an object as described in the WSDL of the Web Service, my question is in the event the Web Service is unable to retrieve/parse the file, what should I return?.

What would be the ideal way for the Web Service to let the client know an error occurred?

Upvotes: 1

Views: 192

Answers (2)

ethrbunny
ethrbunny

Reputation: 10469

If its just XML you could return an empty pair

<result></result>

or

<result>some error code here</result>

But more than likely, since you're using some SOAP layer or other web-service it will have an error mechanism.

Upvotes: 1

Clajder
Clajder

Reputation: 26

You can catch an exception on the client side according to the web service spec (SOAP serializes exceptions).

Why do you need XML->Object->XML transformation? Is there any business logic underneath?

Upvotes: 1

Related Questions