title: SOAP Webservice error - design practice
body: <p>I need to design a SOAP api (my first one!). What are the best practices regarding errors returned to the caller.</p>
  
  <p>Assuming an api as follow</p>
  
  <pre><code>[WebMethod]
  public List&lt;someClass&gt; GetList(String param1)
  {
  }
  </code></pre>
  
  <p>Should I</p>
  
  <ul>
  <li>Throw an exception. Let the SOAP infrastructure generate a SOAP fault -- and the caller would have to try/catch. This is not very explanatory to the caller
  
  <ol start="2">
  <li>Have the return parameter be a XMLDOcument of some sort, with the first element being a return value and then the List. </li>
  <li>Looking at the return SOAP packet I see that the response generated looks like the following</li>
  </ol></li>
  </ul>
  
  <blockquote>
    <p></p>
  </blockquote>
  
  <pre><code> &lt;GetListResponse&gt;
     &lt;GetListResult&gt;
       ...
       ...   
   &lt;/GetListResult&gt;
  &lt;/GetListResponse&gt; 
  </code></pre>
  
  <p>Can we somehow change the return packet so that the "GetListResult" element is changed to "GetListError" in case of error</p>
  
  <ul>
  <li>Any other way?</li>
  </ul>
  
  <p>Thanks!</p>