所以我用C#编写了简单的asmx .NET Web服务。所有异常都被捕获并重新抛出为 SoapException ,详细信息属性设置为XmlNode,其中包含三个子节点,其中包含有关已发生异常的其他信息。在Java端服务器上,异常表面为SoapFaultException。但是当我尝试打印 ex.getFault()。getDetail()时,它似乎是 null 。所以我的问题是为什么会发生这种情况或者我做错了什么?
最后成功获得原始SOAP响应:
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Tue, 04 Oct 2011 20:13:21 GMT
Content-Length: 2143
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org /soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: ...</faultstring>
<faultactor>CustomSoapException</faultactor>
<detail>
<CustomExceptionType>BackendException</CustomExceptionType>
<UserMessage>Internal application error occured. Please contact application developer for quick resolution.</UserMessage>
<DeveloperMessage>Exception details: ....</DeveloperMessage>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>