1

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.

dbc
  • 104,963
  • 20
  • 228
  • 340

1 Answers1

0

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.

rahulaga-msft
  • 3,964
  • 6
  • 26
  • 44
  • I appreciate you help Rahul. but its not our service its third party. I have added the response too that I get from the API. Can you look at it and help me. Thanks you so much again – Khurram Syed Feb 02 '18 at 16:08
  • hmm, may i know "**I do get the meaningful messages when I run it in SOAP UI tool **" exact message you are getting ? – rahulaga-msft Feb 02 '18 at 16:13
  • example this is coming from the API response when I run it in SOAP UI: 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 <a href="/WebApp/TerminalList/"> local terminal</a> This is a meaningful message. not schemaValidationError or GeneralErroMessage. – Khurram Syed Feb 02 '18 at 16:15
  • Ideally FaultException detail property should have captured message. is it httpbinding ? I mean is there a way to capture http response (say using developer tool) to see exact SOAP body before its gets deserialized at client end – rahulaga-msft Feb 02 '18 at 16:38
  • are you sure request is exactly same when you invoke from tool and .Net code ? – rahulaga-msft Feb 02 '18 at 16:39
  • yes request is exactly same. Its just that when real user put some wrong values then I get these messages. I have tried FaultException but nothing there too. When I run the same request in SOAP UI it give me the proper messages. – Khurram Syed Feb 02 '18 at 16:49
  • i still strongly feel that error you getting while calling service using .net code is because of different reason (what i mean to say is that your request is not even reached to point responsible for throwing exception with details when not using soap ui tool) – rahulaga-msft Feb 02 '18 at 17:10
  • @KhurramSyed : any luck ? did you managed to capture response when using .net code (the way you did from UI tool and posted as part of original question) – rahulaga-msft Feb 03 '18 at 03:39
  • nope still no luck. I know that why errors are coming. I know what I am sending wrong but the only problem is that user needs to see those message when calling this API. which they are not. – Khurram Syed Feb 05 '18 at 06:33
  • @KhurramSyed : I think the whole point here is why you see error while consuming service from UI tool and not when using .Net Code. – rahulaga-msft Feb 05 '18 at 06:37