Date: Thu, 6 Aug 2015 17:09:07 +0800
Subject: client program doesn't get exception for a http 500 staus response
From: ysliu...@gmail.com
To: java-user@axis.apache.org

I'm working with axis2 1.5.1, and try to use it as webservice client.when I try 
to invoke a oneway webservice operation, I found if the server return http 500, 
I didn't got any exception in client side.but for other status code, like, http 
404, I can get an exception.I made some study on axis2 source code.and found 
the logic in following method, 
org.apache.axis2.transport.http.HTTPSender.handleResponse(MessageContext, 
HttpMethodBase):
for  HttpStatus.SC_INTERNAL_SERVER_ERROR || HttpStatus.SC_BAD_REQUEif the 
operation is 2 way operation, set ProcessingFault to true for income 
message.but for one way operation, there is no special action, except just try 
to process the response.since 1 way operation doesn't expected a response soap 
message, the response seems was discarded.I want to know is there any special 
consideration for such behavior?should't a exception be thrown out when 
response status code is 500 and operation is of  one way?

MG>One way-operation in the west means as you soon as request arrives at 
destination you never return
MG>Is One-way-operation classified differently in the East?

I inline the method I mentioned for convenient review.in addition, I checked 
source of axis2 1.6, and found the behavior is as the same.  


     * Used to handle the HTTP Response     *     * @param msgContext - The 
MessageContext of the message     * @param method     - The HTTP method used    
 * @throws IOException - Thrown in case an exception occurs     */    private 
void handleResponse(MessageContext msgContext,                                
HttpMethodBase method) throws IOException {        int statusCode = 
method.getStatusCode();        log.trace("Handling response - " + statusCode);  
      if (statusCode == HttpStatus.SC_OK) {            processResponse(method, 
msgContext);        } else if (statusCode == HttpStatus.SC_ACCEPTED) {        } 
else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR ||                
statusCode == HttpStatus.SC_BAD_REQUEST) {            Header contenttypeHeader 
=                    
method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);            String 
value = null;            if (contenttypeHeader != null) {                value 
= contenttypeHeader.getValue();            }             OperationContext 
opContext = msgContext.getOperationContext();            if(opContext!=null){   
             MessageContext inMessageContext =                        
opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);              
  if(inMessageContext!=null){                    
inMessageContext.setProcessingFault(true);                }            }        
    if (value != null) {
                processResponse(method, msgContext);            }            
//should't a exception be thrown out here in a else branch like            
//else{                    // throw new 
AxisFault(Messages.getMessage("transportError", String.valueOf(statusCode),  
method.getStatusText()));            //}


            Object isTransportNonBlocking = msgContext.getProperty(             
       MessageContext.TRANSPORT_NON_BLOCKING);            if 
(isTransportNonBlocking != null && (Boolean)isTransportNonBlocking) {           
     throw new AxisFault(Messages.getMessage("transportError",                  
      String.valueOf(statusCode),                        
method.getStatusText()));            }        } else {            throw new 
AxisFault(Messages.getMessage("transportError",                                 
                   String.valueOf(statusCode),                                  
                  method.getStatusText()));        }    }thanksysliu            
                        

Reply via email to