axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorge Fernandez <informaticu007-...@yahoo.es>
Subject Re: Improved Error Response for Bad Requests on ADB
Date Mon, 24 Sep 2007 17:25:46 GMT

 Hi Amila,

Sorry for the late response but I've been very busy last days trying to finish my final project
to get my degree. 

Yes it is true that when there is a NPE the excepcion should be thrown as Axis2 fault. As
you can see, in exception A, the message contains an Axis2 fault and is well formed but the
client seems to have a little confusion because  when  client receives this one, it receives
it as a Remote Exception instead of Axis2 fault. 

If the client does e.getMessage(), the message printed is: "unknown". 
  If it does e.printStackTrace(), the message printed is:
 org.apache.axis2.AxisFault: unknown
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)  at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)

at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
 at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) 
at client.Medici_LinkStub.validate  (Medici_LinkStub.java:1044) 
at client.ClientUtilities.validateTest(ClientUtilities.java:57) 
at  client.Client.main(Client.java:72)

What is strange to me is the  getInboundFaultFromMessageContext(Utils.java:486).

As I said, the exception is well formed but besides of being an Axis2 fault, the action is
validateDataAccessException and I don't know if that is right.




In the case of exception B, it was thrown from the message receiver, not from the skeleton,
in the try {}catch inside invokeBusinessLogic method, inside the following if statement:

if((op.getName()!=null) && ((methodName= org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName.getLocalPart()))!=null))

I'm doing 
if(sessionControl.getSystem==null)
    buildValidationException("SYSTEM NOT VALIDATED. YOU MUST VALIDATE BEFORE INVOKING A METHOD.");

that is the place where I sent exception B, and that is the case when the fault action was
sent wrongly. The buildValidationException  method was this:

 public static ValidationException buildValidationException(String _message, Logger _logger){

       if(_logger!=null) 
           _logger.error(_message);
       ValidationException exception=new  ValidationException("Validation Fault");
       ValidationFault fault=new ValidationFault(); 
       fault.setDescription(_message);
       exception.setFaultMessage (fault);
       return exception;
}


Thanks,

Jorge Fernández


Exception A


        HTTP/1.1 500 Error Interno del  Servidor
        Server: Apache-Coyote/1.1
        Content-Type: application/soap+xml; action="urn:validateDataAccessException";charset=UTF-8

        Transfer-Encoding: chunked
        Date: Fri, 31 Aug 2007 11:01:01 GMT
        Connection: close
    
        b36
        <?xml version='1.0' encoding='UTF-8'?>
          <soapenv:Envelope xmlns:soapenv=" http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing
">
             <soapenv:Header>
                 <wsa:Action>urn:validateDataAccessException</wsa:Action>
                <wsa:RelatesTo>urn:uuid:578695F1A346B244751188558061265</wsa:RelatesTo>
             </soapenv:Header>
             <soapenv:Body>
                <soapenv:Fault>
                   <soapenv:Code>
                       <soapenv:Value>soapenv:Receiver</soapenv:Value>
                   </soapenv:Code> 
                   <soapenv:Reason>
                      <soapenv:Text xml:lang="en-US">unknown</soapenv:Text> 
                   </soapenv:Reason>
                   <soapenv:Detail>
                      <Exception> 
                   org.apache.axis2.AxisFault&#xd;       at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)&#xd;
       at medici_link.Medici_LinkMessageReceiverInOut.invokeBusinessLogic(Medici_LinkMessageReceiverInOut.java:388)&#xd;
      at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic (AbstractInOutSyncMessageReceiver.java:42)&#xd;
      at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java
:96)&#xd;     at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java :145)&#xd;
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)&#xd;
 at org.apache.axis2.transport.http.AxisServlet.doPost  (AxisServlet.java:120)&#xd;  
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)&#xd;    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)&#xd;
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
 (ApplicationFilterChain.java:290)&#xd;       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)&#xd;
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java :228)&#xd;
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)&#xd;
    at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:128)&#xd;
  at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:104)&#xd;
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)&#xd;
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)&#xd;
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)&#xd;
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)&#xd;
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run (JIoEndpoint.java:445)&#xd;
 at java.lang.Thread.run (Unknown Source)&#xd;Caused by: java.lang.NullPointerException&#xd;
     at medici_link.Medici_LinkUtilities.getAlias(Medici_LinkUtilities.java:546)&#xd;
       at medici_link.Medici_LinkSkeleton.validate(Medici_LinkSkeleton.java:143)&#xd;
 at  medici_link.Medici_LinkMessageReceiverInOut.invokeBusinessLogic(Medici_LinkMessageReceiverInOut.java:85)&#xd;
       ... 19 more&#xd;
              </Exception>
                   </soapenv:Detail>
                </soapenv:Fault>
             </soapenv:Body>
          </soapenv:Envelope>
        0


Exception B

        HTTP/1.1 500 Error Interno del Servidor
        Server: Apache-Coyote/1.1
         Content-Type: application/soap+xml; action="urn:getPatientsByTypeDataAccessException";charset=UTF-8
        Transfer-Encoding: chunked
        Date: Fri, 31 Aug 2007 11:01:01 GMT 
        Connection: close

        323
        <?xml version=' 1.0' encoding='UTF-8'?>
          <soapenv:Envelope xmlns:soapenv=" http://www.w3.org/2003/05/soap-envelope " xmlns:wsa="http://www.w3.org/2005/08/addressing
">
             <soapenv:Header> 
                 <wsa:Action>urn:getPatientsByTypeDataAccessException</wsa:Action>
                <wsa:RelatesTo>urn:uuid:578695F1A346B244751188558062363</wsa:RelatesTo>

             </soapenv:Header>
             <soapenv:Body>
                <soapenv:Fault>
                   <soapenv:Code>
                       <soapenv:Value>soapenv:Receiver</soapenv:Value>
                   </soapenv:Code> 
                   <soapenv:Reason> 
                      <soapenv:Text xml:lang="en-US">Validation Fault</soapenv:Text>
                   </soapenv:Reason>
                   <soapenv:Detail>
                      <ns3:ValidationFault xmlns:ns3="  http://op_messages.medici_link/xsd">
                         <ns3:description>SYSTEM NOT VALIDATED. YOU MUST VALIDATE BEFORE
INVOKING A METHOD.</ns3:description> 
              </ns3:ValidationFault>
                   </soapenv:Detail>
                 </soapenv:Fault>
             </soapenv:Body>
          </soapenv:Envelope>



Amila Suriarachchi <amilasuriarachchi@gmail.com> escribió:
  if there is a null pointer exception it is correct to throw the Axis2 fault.
 I tried with the validation exception and it worked correctly. which operation send the fault
action wrongly?
 can you send a sample skelton code? 


          



       
---------------------------------

Sé un Mejor Amante del Cine
¿Quieres saber cómo? ¡Deja que otras personas te ayuden!.

Mime
View raw message