Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is my current workaround:</p> <pre><code> /// &lt;summary&gt; /// Replacement for the static methods on FaultCode to generate Sender and Receiver fault codes due /// to what seems like bugs in the implementation for basicHttpBinding (SOAP 1.1). wsHttpBinding /// (SOAP 1.2) seems to work just fine. /// /// The subCode parameter for FaultCode.CreateReceiverFaultCode and FaultCode.CreateSenderFaultCode /// seem to take over the main 'faultcode' value in the SOAP 1.1 response, whereas in SOAP 1.2 the /// subCode is correctly put under the 'Code-&gt;SubCode-&gt;Value' value in the XML response. /// /// This workaround is to create the FaultCode with Sender/Receiver (SOAP 1.2 terms, but gets /// translated by WCF depending on the binding) and an agnostic namespace found by using reflector /// on the FaultCode class. When that NS is passed in WCF seems to be able to generate the proper /// response with SOAP 1.1 (Client/Server) and SOAP 1.2 (Sender/Receiver) fault codes automatically. /// /// This means that it is not possible to create a FaultCode that works in both bindings with /// subcodes. /// &lt;/summary&gt; /// &lt;remarks&gt; /// See http://stackoverflow.com/questions/65008/net-wcf-faults-generating-incorrect-soap-11-faultcode-values /// for more details. /// &lt;/remarks&gt; public static class FaultCodeFactory { private const string _ns = "http://schemas.microsoft.com/ws/2005/05/envelope/none"; /// &lt;summary&gt; /// Creates a sender fault code. /// &lt;/summary&gt; /// &lt;returns&gt;A FaultCode object.&lt;/returns&gt; /// &lt;remarks&gt;Does not support subcodes due to a WCF bug.&lt;/remarks&gt; public static FaultCode CreateSenderFaultCode() { return new FaultCode("Sender", _ns); } /// &lt;summary&gt; /// Creates a receiver fault code. /// &lt;/summary&gt; /// &lt;returns&gt;A FaultCode object.&lt;/returns&gt; /// &lt;remarks&gt;Does not support subcodes due to a WCF bug.&lt;/remarks&gt; public static FaultCode CreateReceiverFaultCode() { return new FaultCode("Receiver", _ns); } } </code></pre> <p>Sadly I don't see a way to use subcodes without breaking either SOAP 1.1 or 1.2 clients. </p> <p>If you use the Code.SubCode syntax, you can create SOAP 1.1 compatible faultcode values but it breaks SOAP 1.2.</p> <p>If you use the proper subcode support in .NET (either via the static FaultCode methods or one of the overloads) it breaks SOAP 1.1 but works in SOAP 1.2.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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