我想如何正确捕获肥皂异常。我只能将其作为 system.net.webexception(错误 500 HTTP)捕获,但不能作为soapheaderexception 或soap 异常捕获。
我目前的代码是:
Try
'Code
Catch soapExcpHeader As System.Web.Services.Protocols.SoapHeaderException
'Can't catch here
Dim error_desc As String = soapExcpHeader.Detail.OuterXml
Throw New System.Web.Services.Protocols.SoapHeaderException()
Catch soapExcp As System.Web.Services.Protocols.SoapException
'Can't catch here
Dim error_desc As String = soapExcp.Detail.OuterXml
Throw New System.Web.Services.Protocols.SoapException
Catch webExcp As System.Net.WebException
'Here I catch
Console.WriteLine(webExcp.ToString())
Throw webExcp
Catch ex as Exception
'Other types of exceptions
Throw ex
End Try
一如既往地感谢您的回复。