Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Sometimes a little vacation is all you need. Problem solved:</p> <p>SvcUtil generated not one, but two C# types for the generic custom fault ServiceFault. The other one was located deeper in the namespace hierarchy. And trying to catch that other fault works just fine. All the more specific custom faults (that derive from ServiceFault in the XSD) are caught here and I can see the error code and description of the fault. That's all I need right now.</p> <p>However, I still have no C# types generated for the more specific custom faults such as MyMethodFault described in the XSDs. But maybe I'm not supposed to!</p> <p>What I failed to describe in the code examples above is that the specific fault MyMethodFault’s XML in the SOAP response is in inside the Detail-tag of the returned fault:</p> <pre><code>&lt;SOAP-ENV:Fault&gt; &lt;faultcode&gt;SOAP-ENV:Server&lt;/faultcode&gt; &lt;faultstring xml:lang="en"&gt;ServiceException&lt;/faultstring&gt; &lt;detail&gt; &lt;ns2:MyMethodFault xmlns:ns2="urn:salessystem:entity:MyService:v1.0"&gt; &lt;ns2:ErrorCode&gt;1000&lt;/ns2:ErrorCode&gt; &lt;ns2:ErrorDescription&gt;My+Error+Description&lt;/ns2:ErrorDescription&gt; &lt;/ns2:UcsAgreemenFault&gt; &lt;/detail&gt; &lt;/SOAP-ENV:Fault&gt; </code></pre> <p>This fault gets mapped to the "base" ServiceFault in my try/catch. In the SOAP above, you can clearly see the specific fault’s type or name. I don’t know how to get hold of that type/name when the exception is caught, though. All I see is the ErrorCode and ErrorDescription. However, all is well as long as I can catch the ServiceFault and see the code and description.</p> <p>Thanks for any thoughts put in to this or any further comments.</p> <p>/Björn</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload