強いテキスト SOAP 例外をスローする基本的な Web サービス (asmx) があります。以下は、service.asmx と web.config のコードです。IE で以下の形式の Web サービスからの応答を期待しています。しかし、私はIEで「これは例外です」という1行の応答を取得しています。以下に示す形式を取得するのを手伝ってください。web.config ファイルまたは asmx のどこを変更すればよいかわかりません。
service.aspx
============
<%@ WebService Language="C#" Class="zzz" %>
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
[WebServiceBinding()]
public class zzz : WebService
{
[WebMethod()]
public void abc()
{
throw new SoapException("this is the exception", SoapException.ClientFaultCode);
}
}
expecting the response as below
===============================
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Validation Exception</faultstring>
<detail>
<ErrorCode>TESTCODE</ErrorCode>
<ErrorDescription>No matching emp information. Please change your request.</ErrorDescription>
</detail>
</soap:Fault>
web.xml
===============================
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<customErrors mode="On"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>