axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: axis2: how to ignore HTTP response status code?
Date Tue, 05 Apr 2011 13:22:24 GMT

this is the exception location:
//org.apache.axis2.client.OperationClient

            if (resenvelope.hasFault()||responseMessageContext.isProcessingFault()) 
            {
                if (options.isExceptionToBeThrownOnSOAPFault()) {
                    // does the SOAPFault has a detail element for Exception

//I would suggest looking at the envelope and the body of the envelope before passing to getInboundFaultFromMessageContext
log.debug("getEnvelope="+messageContext.getEnvelope());
log.debug("getBody="+messageContext.getEnvelope().getBody());


//                    throw Utils.getInboundFaultFromMessageContext(responseMessageContext);
                }
            }

//passed to org.apache.axis2.util.Utils:

    public static AxisFault getInboundFaultFromMessageContext(MessageContext messageContext)
{
        // Get the fault if it's already been extracted by a handler
        AxisFault result = (AxisFault) messageContext.getProperty(Constants.INBOUND_FAULT_OVERRIDE);
        // Else, extract it from the SOAPBody
        if (result == null) {
            SOAPEnvelope envelope = messageContext.getEnvelope();
            SOAPFault soapFault;
            SOAPBody soapBody;
            if (envelope != null && (soapBody = envelope.getBody()) != null) {
                if ((soapFault = soapBody.getFault()) != null) {
                    return new AxisFault(soapFault, messageContext);
                }
                // If its a REST response the content is not a SOAP envelop and hence we will
                // Have use the soap body as the exception
                if (messageContext.isDoingREST() && soapBody.getFirstElement() !=
null) {
                    return new AxisFault(soapBody.getFirstElement().toString());
                }
            }
            // Not going to be able to
            throw new IllegalArgumentException(
                    "The MessageContext does not have an associated SOAPFault.");
        }
        return result;
    }
//either 
//messageContext.getEnvelope() is null
//messageContext.getEnvelope().getBody() is null

dziekuje,Martin 
______________________________________________ 
Note de déni et de confidentialité
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.




> Date: Tue, 5 Apr 2011 14:24:23 +0200
> From: mn-opera@heuthes.pl
> To: java-user@axis.apache.org
> Subject: axis2: how to ignore HTTP response status code?
> 
> Hello,
> 
> I have to connect with WebService that in case of error return the same
> SOAP envelope as in case of normal operation, but sets HTTP status to
> "500 Internal Server Error". Then I got exception:
> 
> 	java.lang.IllegalArgumentException: The MessageContext does not have an
> associated SOAPFault.
> 		at
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:455)
> 		at
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
> 		at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
> 		at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
> 		at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
> 
> 
> When I change (on my emulator) HTTP status to `200 OK` then all works
> fine. My `InFlow` and `InFaultFlow` are the same.
> 
> How can I set axis2 to ignore HTTP status or use normal `InFlow` for
> responses with HTTP status 5xx?
> 
> Regards,
> Michał
> 
> PS This is copy of my question on StackOverflow:
> http://stackoverflow.com/questions/5551705/axis2-how-to-ignore-http-response-status-code
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
> 
 		 	   		  
Mime
View raw message