title: Service 500 exception response
body: <p>I am calling a webservice that is returning a 500 error:</p>
  
  <pre><code>using (var client = new PSGenericWebService.W_GENERICEMPLOYEEWS_PortTypeClient("GenericPort"))
  {
      client.Endpoint.Behaviors.Add(new MessageBehavior("U", "P"));
      try
      {
          var response = client.GetEmployeeDataByDateRange();
          Console.WriteLine(response.Length);
      }
      catch (Exception e)
      {
          Console.WriteLine(e.Message);
      }
  }
  </code></pre>
  
  <p>I understand the error has something to do with the date range and I ommitted some of the code to that respect. But using fiddler I get the following response:</p>
  
  <blockquote>
    <p>HTTP/1.1 500 Internal Server Error Date: Tue, 18 Dec 2012 17:15:04 GMT
    Content-Length: 732 Content-Type: text/xml; charset=UTF-8
    X-Powered-By: Servlet/2.5 JSP/2.1</p>
  </blockquote>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;SOAP-ENV:Body&gt;
      &lt;SOAP-ENV:Fault&gt;
          &lt;faultcode&gt;SOAP-ENV:Server&lt;/faultcode&gt;
          &lt;faultstring&gt;null&lt;/faultstring&gt;
          &lt;detail&gt;
              &lt;IBResponse xmlns="" type="error"&gt;
                  &lt;DefaultTitle&gt;Integration Broker Response&lt;/DefaultTitle&gt;
                  &lt;StatusCode&gt;20&lt;/StatusCode&gt;
                  &lt;MessageID&gt;74&lt;/MessageID&gt;
                  &lt;DefaultMessage&gt;
                      &lt;![CDATA[From date (2012-11-17) and To date (2012-12-18) Range cannot be greater than 30 days. (27000,74)]]&gt;
                  &lt;/DefaultMessage&gt;
                  &lt;MessageParameters&gt;
                      &lt;Parameter&gt;
                          &lt;![CDATA[2012-11-17]]&gt;
                      &lt;/Parameter&gt;
                      &lt;Parameter&gt;
                          &lt;![CDATA[2012-12-18]]&gt;
                      &lt;/Parameter&gt;
                      &lt;Parameter&gt;
                          &lt;![CDATA[30]]&gt;
                      &lt;/Parameter&gt;
                  &lt;/MessageParameters&gt;
              &lt;/IBResponse&gt;
          &lt;/detail&gt;
      &lt;/SOAP-ENV:Fault&gt;
  &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>The Exception that is returned is just listed as null.  I want to get the DefaultMessage from the returned XML.  So I am not looking for a fix to my code, I am looking at how to parse the returned response for the message I need.  Thank you.</p>