Extracting detail from a WCF FaultException response

前端 未结 4 2468
慢半拍i
慢半拍i 2021-02-19 22:29

I am successfully working with a third party soap service. I have added a service reference to a soap web service which has auto generated the classes.

When an error oc

4条回答
  •  一生所求
    2021-02-19 23:13

    The detail node of the message fault is expected to contain XML. The GetDetail will deserialize this XML into the given object.

    As the contents is not XML it was possible to use this method.

    You can however get access to the XML and read the innerXml value:

    MessageFault msgFault = ex.CreateMessageFault();
    var msg = msgFault.GetReaderAtDetailContents().Value;
    

    This approached worked.

提交回复
热议问题