Not able to get Exception message from SOAP call using service reference .net

601 Views Asked by At

I am using service reference in .NET to call a third party carrier API i.e. ESTES. you can find the wsdl here. now whenever I call it from the code and there are some errors it just throws a FaultException and exception message as GeneralErrorMsg or SchemavalidationError with no meaningful messages. I do get the meaningful messages when I run it in SOAP UI tool but not from .Net code.

Following are some link of images of exception. FYI innerexception is null

Exception Stack Trace Image

Exception Data Property Image

Below is the response that I get, when I run the API using SOAPUI. FYI this is third party API and not ours I am just calling their API

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server</faultcode>
         <faultstring>GeneralErrorMsg</faultstring>
         <detail>
            <bol:generalError xmlns:bol="http://ws.estesexpress.com/bol">
               <bol:error>
                  <bol:code>BOL0193</bol:code>
                  <bol:message>We cannot automatically assign a PRO number if the shipping address is not serviced       directly by Estes.  Please   uncheck the "Assign PRO #" box.  Questions?  Feel free to call your &lt;a href="/WebApp/TerminalList/"> local terminal&lt;/a>.</bol:message>
               </bol:error>
               <bol:error>
                  <bol:code>BOL0101</bol:code>
                  <bol:message>Invalid state/zip combination</bol:message>
               </bol:error>
            </bol:generalError>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

Please help me guys its really giving me hard time.

1

There are 1 best solutions below

10
rahulaga-msft On

Try adding service behavior in web.config file where your service is hosted

<behavior name="faultBehavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
</behavior>

But this has some other down side in terms of security.