[Axis2] How to handle/override Fault in SOAP request

Krishna Kadire <[email protected]> Fri, 21 Sep 2018 04:55:54 +0000
Newsgroups gmane.text.xml.axis.user
Message-ID <AM6PR02MB396068B64822CBB89F7C0E55F2120@AM6PR02MB3960.eurprd02.prod.outlook.com>
Hi,

When we have invalid characters(<,>,&..)   in soap request, example:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/<http://schemas.xmlsoap.org/soap/envelope/>" xmlns:per="http://person.ws<http://person.ws/>">

   <soapenv:Header/>

   <soapenv:Body>

      <per:login>

         <!--Optional:-->

         <per:args0><dfg</per:args0>

         <!--Optional:-->

         <per:args1>secret</per:args1>

      </per:login>

   </soapenv:Body>

</soapenv:Envelope>

We are getting below response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/<http://schemas.xmlsoap.org/soap/envelope/>">

   <soapenv:Header/>

   <soapenv:Body>

      <soapenv:Fault>

         <faultcode>soapenv:Server</faultcode>

         <faultstring>com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '&lt;' (code 60) excepted space, or '>' or "/>"

 at [row,col {unknown-source}]: [6,25]</faultstring>

         <detail/>

      </soapenv:Fault>

   </soapenv:Body>

</soapenv:Envelope>





We are getting kind of stack trace in <faultstring>, is there any way to get user defined error message instead of stacktrace.

can we override handleFault() method in AxisServlet  or can you please provide example of handling fault to show custom messages.







Thanks in Advance



Regards,

Krishna


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10