.NET WCF faults generating incorrect SOAP 1.1 faultcode values

后端 未结 2 1685
日久生厌
日久生厌 2020-12-16 20:50

I am experimenting with using the FaultException and FaultException to determine the best usage pattern in our applications. We need to support WCF as well as non-W

2条回答
  •  旧巷少年郎
    2020-12-16 21:17

    Response from Microsoft:

    As discussed in http://msdn.microsoft.com/en-us/library/ms789039.aspx, there are two methods outlined in the Soap 1.1 specification for custom fault codes:

    (1) Using the "dot" notation as you describe

    (2) Defining entirely new fault codes

    Unfortunately, the "dot" notation should be avoided, as it's use is discouraged in the WS-I Basic Profile specification. Essentially, this means that there is no real equivalent of the Soap 1.2 fault SubCode when using Soap 1.1.

    So, when generating faults, you'll have to be cognizant of the MessageVersion defined in the binding, and generate faultcodes accordingly.

    Since "sender" and "receiver" are not vaild fault codes for Soap 1.1, and there is no real equivalent of a fault subcode, you shouldn't use the CreateSenderFaultCode and CreateReceiverFaultCode methods when generating custom fault codes for Soap 1.1.

    Instead, you'll need to define your own faultcode, using your own namespace and name:

    FaultCode customFaultCode = new FaultCode(localName, faultNamespace);

提交回复
热议问题