You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Krishna Kadire <Kr...@planonsoftware.com> on 2018/09/21 04:48:27 UTC

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

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



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

Posted by Bill Blough <bi...@apache.org>.
I just re-read your message, and realized that you're asking about
changing the error message, not eliminating the error.

I suggest trying to ask the on the java-user list [1], since this is the list
for users of the C version.

Regards,
Bill

[1] https://axis.apache.org/axis2/java/core/mail-lists.html



On Fri, Sep 21, 2018 at 04:48:27AM +0000, Krishna Kadire wrote:
> 
> 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
> 
> 

-- 
GPG: 5CDD 0C9C F446 BC1B 2509  8791 1762 E022 7034 CF84

---------------------------------------------------------------------
To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
For additional commands, e-mail: c-user-help@axis.apache.org


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

Posted by Bill Blough <bi...@apache.org>.
Reserved characters in data need to be converted into entity references [1],
per the XML standard.

In your example,

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

needs to be

    <per:args0>&lt;dfg</per:args0>


Regards,
Bill


[1] https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references



On Fri, Sep 21, 2018 at 04:48:27AM +0000, Krishna Kadire wrote:
> 
> 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
> 
> 

-- 
GPG: 5CDD 0C9C F446 BC1B 2509  8791 1762 E022 7034 CF84

---------------------------------------------------------------------
To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
For additional commands, e-mail: c-user-help@axis.apache.org