i have hardtime to change returned SOAP Message from Exception in ASMX Web Services C#. Here is returned Soap Message Exception right now :
<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: Server was unable to process request. ---> System.ApplicationException: Module Authorization Failed
at BackEnd.Services.Models.ModuleCredential.IsValid(String serviceName)
at BackEnd.DashboardPSI.HelloWorld()
--- End of inner exception stack trace ---</faultstring>
<detail/>
</soap:Fault>
</soap:Body>
</soap:Envelope>
and i want to change to like this :
<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>Server was unable to process request. ---> Module Authorization Failed</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I'm using ASMX WebServices at NetFramework 4.5. and using SoapExtension to Log the exception. Thanks
public class Base: System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
throw new ApplicationException("Module Authorization Failed");
}
}
Updated So this fault return with inner exception happens when in development env, when i put in production env, the inner exception is hide. Thanks
So this fault return with inner exception happens when in development env, when i put in production env, the inner exception is hide. Thanks