I’m writing a web method that publishes an xhtml file to a database. This web service should be technology agnostic (support Java applications for example). The publish method returns a string. In the return I want to inform the calling application about the success or failure of the publish. In addition I want to include :
- a collection of parsing errors
- a collection of invalid values (this is determined by matching values in database)
- a message if there is a version conflict
Below is one format I could use. Is there a guideline web service developers follow when formatting web method return values? Thank you.
<result>
<info name="successful" value="true"/>
<info name="successtype" value="partial"/>
<info name="versionconflict" value="false"/>
<parseErr>
<err field="itemId" desc="Missing required element Item Id"/>
<err field="content" desc="Required tag <content> is missing."/>
<err field="purchaseDate desc="Invalid date format. Date should be in mm-dd-yyyy."/>
</parseErr>
<failedAttributes>
<err attribute="userName" value="NULL"/>
<err attribute="orderCategory" value="Porduce"/>
</failedAttributes>
</result>
you could look into SOAP faults rather than have failure information as part of the contract methods return value.