Java 类javax.xml.ws.ProtocolException 实例源码

项目:OpenJSharp    文件:SOAPHandlerProcessor.java   
/**
 * Replace the message in the given message context with a
 * fault message. If the context already contains a fault
 * message, then return without changing it.
 *
 * <p>This method should only be called during a request,
 * because during a response an exception from a handler
 * is dispatched rather than replacing the message with
 * a fault. So this method can use the MESSAGE_OUTBOUND_PROPERTY
 * to determine whether it is being called on the client
 * or the server side. If this changes in the spec, then
 * something else will need to be passed to the method
 * to determine whether the fault code is client or server.
 */
final void insertFaultMessage(C context,
    ProtocolException exception) {
    try {
        if(!context.getPacketMessage().isFault()) {
            Message faultMessage = Messages.create(binding.getSOAPVersion(),
                    exception,determineFaultCode(binding.getSOAPVersion()));
            context.setPacketMessage(faultMessage);
        }
    } catch (Exception e) {
        // severe since this is from runtime and not handler
        logger.log(Level.SEVERE,
            "exception while creating fault message in handler chain", e);
        throw new RuntimeException(e);
    }
}
项目:openjdk-jdk10    文件:SOAPHandlerProcessor.java   
/**
 * Replace the message in the given message context with a
 * fault message. If the context already contains a fault
 * message, then return without changing it.
 *
 * <p>This method should only be called during a request,
 * because during a response an exception from a handler
 * is dispatched rather than replacing the message with
 * a fault. So this method can use the MESSAGE_OUTBOUND_PROPERTY
 * to determine whether it is being called on the client
 * or the server side. If this changes in the spec, then
 * something else will need to be passed to the method
 * to determine whether the fault code is client or server.
 */
final void insertFaultMessage(C context,
    ProtocolException exception) {
    try {
        if(!context.getPacketMessage().isFault()) {
            Message faultMessage = Messages.create(binding.getSOAPVersion(),
                    exception,determineFaultCode(binding.getSOAPVersion()));
            context.setPacketMessage(faultMessage);
        }
    } catch (Exception e) {
        // severe since this is from runtime and not handler
        logger.log(Level.SEVERE,
            "exception while creating fault message in handler chain", e);
        throw new RuntimeException(e);
    }
}
项目:openjdk9    文件:SOAPHandlerProcessor.java   
/**
 * Replace the message in the given message context with a
 * fault message. If the context already contains a fault
 * message, then return without changing it.
 *
 * <p>This method should only be called during a request,
 * because during a response an exception from a handler
 * is dispatched rather than replacing the message with
 * a fault. So this method can use the MESSAGE_OUTBOUND_PROPERTY
 * to determine whether it is being called on the client
 * or the server side. If this changes in the spec, then
 * something else will need to be passed to the method
 * to determine whether the fault code is client or server.
 */
final void insertFaultMessage(C context,
    ProtocolException exception) {
    try {
        if(!context.getPacketMessage().isFault()) {
            Message faultMessage = Messages.create(binding.getSOAPVersion(),
                    exception,determineFaultCode(binding.getSOAPVersion()));
            context.setPacketMessage(faultMessage);
        }
    } catch (Exception e) {
        // severe since this is from runtime and not handler
        logger.log(Level.SEVERE,
            "exception while creating fault message in handler chain", e);
        throw new RuntimeException(e);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SOAPHandlerProcessor.java   
/**
 * Replace the message in the given message context with a
 * fault message. If the context already contains a fault
 * message, then return without changing it.
 *
 * <p>This method should only be called during a request,
 * because during a response an exception from a handler
 * is dispatched rather than replacing the message with
 * a fault. So this method can use the MESSAGE_OUTBOUND_PROPERTY
 * to determine whether it is being called on the client
 * or the server side. If this changes in the spec, then
 * something else will need to be passed to the method
 * to determine whether the fault code is client or server.
 */
final void insertFaultMessage(C context,
    ProtocolException exception) {
    try {
        if(!context.getPacketMessage().isFault()) {
            Message faultMessage = Messages.create(binding.getSOAPVersion(),
                    exception,determineFaultCode(binding.getSOAPVersion()));
            context.setPacketMessage(faultMessage);
        }
    } catch (Exception e) {
        // severe since this is from runtime and not handler
        logger.log(Level.SEVERE,
            "exception while creating fault message in handler chain", e);
        throw new RuntimeException(e);
    }
}
项目:infobip-open-jdk-8    文件:SOAPHandlerProcessor.java   
/**
 * Replace the message in the given message context with a
 * fault message. If the context already contains a fault
 * message, then return without changing it.
 *
 * <p>This method should only be called during a request,
 * because during a response an exception from a handler
 * is dispatched rather than replacing the message with
 * a fault. So this method can use the MESSAGE_OUTBOUND_PROPERTY
 * to determine whether it is being called on the client
 * or the server side. If this changes in the spec, then
 * something else will need to be passed to the method
 * to determine whether the fault code is client or server.
 */
final void insertFaultMessage(C context,
    ProtocolException exception) {
    try {
        if(!context.getPacketMessage().isFault()) {
            Message faultMessage = Messages.create(binding.getSOAPVersion(),
                    exception,determineFaultCode(binding.getSOAPVersion()));
            context.setPacketMessage(faultMessage);
        }
    } catch (Exception e) {
        // severe since this is from runtime and not handler
        logger.log(Level.SEVERE,
            "exception while creating fault message in handler chain", e);
        throw new RuntimeException(e);
    }
}
项目:curiosity-maps    文件:HeaderCrawler.java   
/**
 * Pulls the {@link ResponseHeader} for {@code uri}.
 */
public ResponseHeader crawl(URL uri) {
    HttpURLConnection.setFollowRedirects(false);
    HttpURLConnection conn = null;
    try {
        conn = (HttpURLConnection) uri.openConnection();
        conn.setRequestMethod("HEAD");
        if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
            throw new IOException("Got unexpected response code: " + conn.getResponseCode());
        }
        return new ResponseHeader(conn.getContentLengthLong(), conn.getHeaderField("ETag"));
    } catch (IOException | ProtocolException e) {
        throw new RuntimeException(e);
    } finally {
        if(conn != null) {
            conn.disconnect();
        }
    }
}
项目:OLD-OpenJDK8    文件:SOAPHandlerProcessor.java   
/**
 * Replace the message in the given message context with a
 * fault message. If the context already contains a fault
 * message, then return without changing it.
 *
 * <p>This method should only be called during a request,
 * because during a response an exception from a handler
 * is dispatched rather than replacing the message with
 * a fault. So this method can use the MESSAGE_OUTBOUND_PROPERTY
 * to determine whether it is being called on the client
 * or the server side. If this changes in the spec, then
 * something else will need to be passed to the method
 * to determine whether the fault code is client or server.
 */
final void insertFaultMessage(C context,
    ProtocolException exception) {
    try {
        if(!context.getPacketMessage().isFault()) {
            Message faultMessage = Messages.create(binding.getSOAPVersion(),
                    exception,determineFaultCode(binding.getSOAPVersion()));
            context.setPacketMessage(faultMessage);
        }
    } catch (Exception e) {
        // severe since this is from runtime and not handler
        logger.log(Level.SEVERE,
            "exception while creating fault message in handler chain", e);
        throw new RuntimeException(e);
    }
}
项目:wso2-axis2    文件:BaseDispatch.java   
/**
 * Returns the fault that is contained within the MessageContext for an invocation. If no fault
 * exists, null will be returned.
 *
 * @param msgCtx
 * @return
 */
public static WebServiceException getFaultResponse(MessageContext msgCtx) {
    try {
        Message msg = msgCtx.getMessage();
        if (msg != null && msg.isFault()) {
            //XMLFault fault = msg.getXMLFault();
            // 4.3.2 conformance bullet 1 requires a ProtocolException here
            ProtocolException pe =
                MethodMarshallerUtils.createSystemException(msg.getXMLFault(), msg);
            return pe;
        } else if (msgCtx.getLocalException() != null) {
            // use the factory, it'll throw the right thing:
            return ExceptionFactory.makeWebServiceException(msgCtx.getLocalException());
        }
    } finally {
        // Free the incoming input stream
        try {
            msgCtx.freeInputStream();
        } catch (IOException ioe) {
            return ExceptionFactory.makeWebServiceException(ioe);
        }
    }

    return null;
}
项目:wso2-axis2    文件:ExceptionFactory.java   
/**
 * Create a ProtocolException using the information from a Throwable and message
 *
 * @param message
 * @param throwable
 * @return ProtocolException
 */
public static ProtocolException makeProtocolException(String message, Throwable throwable) {
    try {
        // See if there is already a ProtocolException
        ProtocolException e =
                (ProtocolException)findException(throwable, ProtocolException.class);
        if (e == null) {
            e = createProtocolException(message, throwable);
        }
        return e;
    } catch (RuntimeException re) {
        // TODO
        // This is not a good situation, an exception occurred while building the exception.
        // This should never occur!  For now log the problem and rethrow...we may revisit this later
        if (log.isDebugEnabled()) {
            log.debug(Messages.getMessage("exceptionDuringExceptionFlow"), re);
        }
        throw re;
    }
}
项目:wso2-axis2    文件:HeadersClientTrackerHandler.java   
public boolean handleMessage(SOAPMessageContext messagecontext) {
    Boolean outbound = (Boolean) messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (outbound) {

        // this is the first client outbound handler hit

        Map<QName, List<String>> requestHeaders = (Map<QName, List<String>>)messagecontext.get(Constants.JAXWS_OUTBOUND_SOAP_HEADERS);

        // this should generate an exception.  We have protection built in to prevent using both
        // the SOAPHeadersAdapter and SAAJ in the same handler method

        List<String> list1 = requestHeaders.get(TestHeaders.ACOH1_HEADER_QNAME);

        try {
            messagecontext.getMessage().getSOAPHeader();
        } catch (SOAPException e) {
            throw new ProtocolException(e);
        }

    }
    else {  // client inbound response
    }
    return true;
}
项目:openjdk-icedtea7    文件:SOAPHandlerProcessor.java   
/**
 * Replace the message in the given message context with a
 * fault message. If the context already contains a fault
 * message, then return without changing it.
 *
 * <p>This method should only be called during a request,
 * because during a response an exception from a handler
 * is dispatched rather than replacing the message with
 * a fault. So this method can use the MESSAGE_OUTBOUND_PROPERTY
 * to determine whether it is being called on the client
 * or the server side. If this changes in the spec, then
 * something else will need to be passed to the method
 * to determine whether the fault code is client or server.
 */
final void insertFaultMessage(C context,
    ProtocolException exception) {
    try {
        if(!context.getPacketMessage().isFault()) {
            Message faultMessage = Messages.create(binding.getSOAPVersion(),
                    exception,determineFaultCode(binding.getSOAPVersion()));
            context.setPacketMessage(faultMessage);
        }
    } catch (Exception e) {
        // severe since this is from runtime and not handler
        logger.log(Level.SEVERE,
            "exception while creating fault message in handler chain", e);
        throw new RuntimeException(e);
    }
}
项目:OpenJSharp    文件:XMLHandlerProcessor.java   
final void insertFaultMessage(C context,
        ProtocolException exception) {
    if(exception instanceof HTTPException) {
        context.put(MessageContext.HTTP_RESPONSE_CODE,((HTTPException)exception).getStatusCode());
    }
    if (context != null) {
        // non-soap case
        context.setPacketMessage(Messages.createEmpty(binding.getSOAPVersion()));
    }
}
项目:OpenJSharp    文件:TieHandler.java   
public Message createResponse(JavaCallInfo call) {
        Message responseMessage;
        if (call.getException() == null) {
            responseMessage = isOneWay ? null : createResponseMessage(call.getParameters(), call.getReturnValue());
        } else {
            Throwable e = call.getException();
            Throwable serviceException = getServiceException(e);
            if (e instanceof InvocationTargetException || serviceException != null) {
//              Throwable cause = e.getCause();
              //if (!(cause instanceof RuntimeException) && cause instanceof Exception) {
                if (serviceException != null) {
                    // Service specific exception
                    LOGGER.log(Level.FINE, serviceException.getMessage(), serviceException);
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion,
                            javaMethodModel.getCheckedException(serviceException.getClass()), serviceException);
                } else {
                    Throwable cause = e.getCause();
                    if (cause instanceof ProtocolException) {
                        // Application code may be throwing it intentionally
                        LOGGER.log(Level.FINE, cause.getMessage(), cause);
                    } else {
                        // Probably some bug in application code
                        LOGGER.log(Level.SEVERE, cause.getMessage(), cause);
                    }
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, cause);
                }
            } else if (e instanceof DispatchException) {
                responseMessage = ((DispatchException)e).fault;
            } else {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
                responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
            }
        }
//        return req.createServerResponse(responseMessage, req.endpoint.getPort(), javaMethodModel.getOwner(), req.endpoint.getBinding());

        return responseMessage;
    }
项目:openjdk-jdk10    文件:XMLHandlerProcessor.java   
final void insertFaultMessage(C context,
        ProtocolException exception) {
    if(exception instanceof HTTPException) {
        context.put(MessageContext.HTTP_RESPONSE_CODE,((HTTPException)exception).getStatusCode());
    }
    if (context != null) {
        // non-soap case
        context.setPacketMessage(Messages.createEmpty(binding.getSOAPVersion()));
    }
}
项目:openjdk-jdk10    文件:TieHandler.java   
public Message createResponse(JavaCallInfo call) {
        Message responseMessage;
        if (call.getException() == null) {
            responseMessage = isOneWay ? null : createResponseMessage(call.getParameters(), call.getReturnValue());
        } else {
            Throwable e = call.getException();
            Throwable serviceException = getServiceException(e);
            if (e instanceof InvocationTargetException || serviceException != null) {
//              Throwable cause = e.getCause();
              //if (!(cause instanceof RuntimeException) && cause instanceof Exception) {
                if (serviceException != null) {
                    // Service specific exception
                    LOGGER.log(Level.FINE, serviceException.getMessage(), serviceException);
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion,
                            javaMethodModel.getCheckedException(serviceException.getClass()), serviceException);
                } else {
                    Throwable cause = e.getCause();
                    if (cause instanceof ProtocolException) {
                        // Application code may be throwing it intentionally
                        LOGGER.log(Level.FINE, cause.getMessage(), cause);
                    } else {
                        // Probably some bug in application code
                        LOGGER.log(Level.SEVERE, cause.getMessage(), cause);
                    }
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, cause);
                }
            } else if (e instanceof DispatchException) {
                responseMessage = ((DispatchException)e).fault;
            } else {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
                responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
            }
        }
//        return req.createServerResponse(responseMessage, req.endpoint.getPort(), javaMethodModel.getOwner(), req.endpoint.getBinding());

        return responseMessage;
    }
项目:openjdk9    文件:XMLHandlerProcessor.java   
final void insertFaultMessage(C context,
        ProtocolException exception) {
    if(exception instanceof HTTPException) {
        context.put(MessageContext.HTTP_RESPONSE_CODE,((HTTPException)exception).getStatusCode());
    }
    if (context != null) {
        // non-soap case
        context.setPacketMessage(Messages.createEmpty(binding.getSOAPVersion()));
    }
}
项目:openjdk9    文件:TieHandler.java   
public Message createResponse(JavaCallInfo call) {
        Message responseMessage;
        if (call.getException() == null) {
            responseMessage = isOneWay ? null : createResponseMessage(call.getParameters(), call.getReturnValue());
        } else {
            Throwable e = call.getException();
            Throwable serviceException = getServiceException(e);
            if (e instanceof InvocationTargetException || serviceException != null) {
//              Throwable cause = e.getCause();
              //if (!(cause instanceof RuntimeException) && cause instanceof Exception) {
                if (serviceException != null) {
                    // Service specific exception
                    LOGGER.log(Level.FINE, serviceException.getMessage(), serviceException);
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion,
                            javaMethodModel.getCheckedException(serviceException.getClass()), serviceException);
                } else {
                    Throwable cause = e.getCause();
                    if (cause instanceof ProtocolException) {
                        // Application code may be throwing it intentionally
                        LOGGER.log(Level.FINE, cause.getMessage(), cause);
                    } else {
                        // Probably some bug in application code
                        LOGGER.log(Level.SEVERE, cause.getMessage(), cause);
                    }
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, cause);
                }
            } else if (e instanceof DispatchException) {
                responseMessage = ((DispatchException)e).fault;
            } else {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
                responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
            }
        }
//        return req.createServerResponse(responseMessage, req.endpoint.getPort(), javaMethodModel.getOwner(), req.endpoint.getBinding());

        return responseMessage;
    }
项目:lookaside_java-1.8.0-openjdk    文件:XMLHandlerProcessor.java   
final void insertFaultMessage(C context,
        ProtocolException exception) {
    if(exception instanceof HTTPException) {
        context.put(MessageContext.HTTP_RESPONSE_CODE,((HTTPException)exception).getStatusCode());
    }
    if (context != null) {
        // non-soap case
        context.setPacketMessage(Messages.createEmpty(binding.getSOAPVersion()));
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:TieHandler.java   
public Message createResponse(JavaCallInfo call) {
        Message responseMessage;
        if (call.getException() == null) {
            responseMessage = isOneWay ? null : createResponseMessage(call.getParameters(), call.getReturnValue());
        } else {
            Throwable e = call.getException();
            Throwable serviceException = getServiceException(e);
            if (e instanceof InvocationTargetException || serviceException != null) {
//              Throwable cause = e.getCause();
              //if (!(cause instanceof RuntimeException) && cause instanceof Exception) {
                if (serviceException != null) {
                    // Service specific exception
                    LOGGER.log(Level.FINE, serviceException.getMessage(), serviceException);
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion,
                            javaMethodModel.getCheckedException(serviceException.getClass()), serviceException);
                } else {
                    Throwable cause = e.getCause();
                    if (cause instanceof ProtocolException) {
                        // Application code may be throwing it intentionally
                        LOGGER.log(Level.FINE, cause.getMessage(), cause);
                    } else {
                        // Probably some bug in application code
                        LOGGER.log(Level.SEVERE, cause.getMessage(), cause);
                    }
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, cause);
                }
            } else if (e instanceof DispatchException) {
                responseMessage = ((DispatchException)e).fault;
            } else {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
                responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
            }
        }
//        return req.createServerResponse(responseMessage, req.endpoint.getPort(), javaMethodModel.getOwner(), req.endpoint.getBinding());

        return responseMessage;
    }
项目:mycarenet    文件:WSSecuritySOAPHandler.java   
@Override
public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context
            .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (false == outboundProperty) {
        return true;
    }
    try {
        handleOutboundMessage(context);
    } catch (Exception e) {
        LOG.error("outbound exception: " + e.getMessage(), e);
        throw new ProtocolException(e);
    }
    return true;
}
项目:mycarenet    文件:WSSecuritySOAPHandler.java   
@Override
public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context
            .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (false == outboundProperty) {
        return true;
    }
    try {
        handleOutboundMessage(context);
    } catch (Exception e) {
        LOG.error("outbound exception: " + e.getMessage(), e);
        throw new ProtocolException(e);
    }
    return true;
}
项目:mycarenet    文件:SecuritySOAPHandler.java   
@Override
public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context
            .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (false == outboundProperty) {
        return true;
    }
    try {
        handleOutboundMessage(context);
    } catch (Exception e) {
        LOG.error("outbound exception: " + e.getMessage(), e);
        throw new ProtocolException(e);
    }
    return true;
}
项目:infobip-open-jdk-8    文件:XMLHandlerProcessor.java   
final void insertFaultMessage(C context,
        ProtocolException exception) {
    if(exception instanceof HTTPException) {
        context.put(MessageContext.HTTP_RESPONSE_CODE,((HTTPException)exception).getStatusCode());
    }
    if (context != null) {
        // non-soap case
        context.setPacketMessage(Messages.createEmpty(binding.getSOAPVersion()));
    }
}
项目:infobip-open-jdk-8    文件:TieHandler.java   
public Message createResponse(JavaCallInfo call) {
        Message responseMessage;
        if (call.getException() == null) {
            responseMessage = isOneWay ? null : createResponseMessage(call.getParameters(), call.getReturnValue());
        } else {
            Throwable e = call.getException();
            Throwable serviceException = getServiceException(e);
            if (e instanceof InvocationTargetException || serviceException != null) {
//              Throwable cause = e.getCause();
              //if (!(cause instanceof RuntimeException) && cause instanceof Exception) {
                if (serviceException != null) {
                    // Service specific exception
                    LOGGER.log(Level.FINE, serviceException.getMessage(), serviceException);
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion,
                            javaMethodModel.getCheckedException(serviceException.getClass()), serviceException);
                } else {
                    Throwable cause = e.getCause();
                    if (cause instanceof ProtocolException) {
                        // Application code may be throwing it intentionally
                        LOGGER.log(Level.FINE, cause.getMessage(), cause);
                    } else {
                        // Probably some bug in application code
                        LOGGER.log(Level.SEVERE, cause.getMessage(), cause);
                    }
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, cause);
                }
            } else if (e instanceof DispatchException) {
                responseMessage = ((DispatchException)e).fault;
            } else {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
                responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
            }
        }
//        return req.createServerResponse(responseMessage, req.endpoint.getPort(), javaMethodModel.getOwner(), req.endpoint.getBinding());

        return responseMessage;
    }
项目:dssp    文件:AttestationSOAPHandler.java   
@Override
public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (outboundProperty) {
        return true;
    }
    try {
        handleInboundMessage(context);
    } catch (Exception e) {
        LOGGER.error("error: " + e.getMessage(), e);
        throw new ProtocolException(e);
    }
    return true;
}
项目:dssp    文件:WSTrustSOAPHandler.java   
@Override
public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context
            .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (false == outboundProperty) {
        try {
            handleInboundMessage(context);
        } catch (Exception e) {
            throw new ProtocolException(e);
        }
    }
    return true;
}
项目:dssp    文件:WSSecuritySOAPHandler.java   
@Override
public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

    if (true == outboundProperty.booleanValue()) {
        try {
            handleOutboundMessage(context);
        } catch (Exception e) {
            LOGGER.error("outbound exception: " + e.getMessage(), e);
            throw new ProtocolException(e);
        }
    }
    return true;
}
项目:dssp    文件:WSSecuritySOAPHandler.java   
@Override
public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (false == outboundProperty.booleanValue()) {
        try {
            handleInboundMessage(context);
        } catch (Exception e) {
            throw new ProtocolException(e);
        }
    }
    return true;
}
项目:OLD-OpenJDK8    文件:XMLHandlerProcessor.java   
final void insertFaultMessage(C context,
        ProtocolException exception) {
    if(exception instanceof HTTPException) {
        context.put(MessageContext.HTTP_RESPONSE_CODE,((HTTPException)exception).getStatusCode());
    }
    if (context != null) {
        // non-soap case
        context.setPacketMessage(Messages.createEmpty(binding.getSOAPVersion()));
    }
}
项目:OLD-OpenJDK8    文件:TieHandler.java   
public Message createResponse(JavaCallInfo call) {
        Message responseMessage;
        if (call.getException() == null) {
            responseMessage = isOneWay ? null : createResponseMessage(call.getParameters(), call.getReturnValue());
        } else {
            Throwable e = call.getException();
            Throwable serviceException = getServiceException(e);
            if (e instanceof InvocationTargetException || serviceException != null) {
//              Throwable cause = e.getCause();
              //if (!(cause instanceof RuntimeException) && cause instanceof Exception) {
                if (serviceException != null) {
                    // Service specific exception
                    LOGGER.log(Level.FINE, serviceException.getMessage(), serviceException);
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion,
                            javaMethodModel.getCheckedException(serviceException.getClass()), serviceException);
                } else {
                    Throwable cause = e.getCause();
                    if (cause instanceof ProtocolException) {
                        // Application code may be throwing it intentionally
                        LOGGER.log(Level.FINE, cause.getMessage(), cause);
                    } else {
                        // Probably some bug in application code
                        LOGGER.log(Level.SEVERE, cause.getMessage(), cause);
                    }
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, cause);
                }
            } else if (e instanceof DispatchException) {
                responseMessage = ((DispatchException)e).fault;
            } else {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
                responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
            }
        }
//        return req.createServerResponse(responseMessage, req.endpoint.getPort(), javaMethodModel.getOwner(), req.endpoint.getBinding());

        return responseMessage;
    }
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public void testHandleMessage_protocolex_true2() {

        // reset result
        result = "";

        soaphandler1_MessageResultDesired = ResultDesired.TRUE;
        soaphandler1_FaultResultDesired = ResultDesired.TRUE;
        soaphandler2_MessageResultDesired = ResultDesired.TRUE;
        soaphandler2_FaultResultDesired = ResultDesired.TRUE;
        logicalhandler1_MessageResultDesired = ResultDesired.PROTOCOL_EXCEPTION;
        logicalhandler1_FaultResultDesired = ResultDesired.TRUE;
        logicalhandler2_MessageResultDesired = ResultDesired.TRUE;
        logicalhandler2_FaultResultDesired = ResultDesired.TRUE;

        HandlerChainProcessor processor = new HandlerChainProcessor(handlers, Protocol.soap11);
        MessageContext mc1 = new MessageContext();
        mc1.setMEPContext(new MEPContext(mc1));
        Exception e = null;
        try {
            processor.processChain(mc1.getMEPContext(),
                                   HandlerChainProcessor.Direction.IN,
                                   HandlerChainProcessor.MEP.REQUEST,
                                   false);
        } catch (ProtocolException pe) {
            e = pe;
        }
        assertNull(e);
        // no handleFault calls
        assertEquals("S2m:S1m:L1m:L1c:S1c:S2c:", result);
    }
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public void testHandleMessage_protocolex_protocolex() {

        // reset result
        result = "";

        // we want one false response:
        soaphandler1_MessageResultDesired = ResultDesired.TRUE;
        soaphandler1_FaultResultDesired = ResultDesired.PROTOCOL_EXCEPTION;
        soaphandler2_MessageResultDesired = ResultDesired.TRUE;
        soaphandler2_FaultResultDesired = ResultDesired.TRUE;
        logicalhandler1_MessageResultDesired = ResultDesired.PROTOCOL_EXCEPTION;
        logicalhandler1_FaultResultDesired = ResultDesired.TRUE;
        logicalhandler2_MessageResultDesired = ResultDesired.TRUE;
        logicalhandler2_FaultResultDesired = ResultDesired.TRUE;

        HandlerChainProcessor processor = new HandlerChainProcessor(handlers, Protocol.soap11);
        MessageContext mc1 = new MessageContext();
        mc1.setMEPContext(new MEPContext(mc1));
        Exception e = null;
        try {
            // handleFault processing, but notice S2f does not get called, and we get an exception
            processor.processChain(mc1.getMEPContext(),
                                   HandlerChainProcessor.Direction.IN,
                                   HandlerChainProcessor.MEP.REQUEST,
                                   true);
        } catch (ProtocolException pe) {
            e = pe;
        }

        assertNotNull(e);
        assertEquals("S2m:S1m:L1m:S1f:L1c:S1c:S2c:", result);
    }
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public void testHandleFault_protocolex() {

        // reset result
        result = "";

        // we want one false response:
        soaphandler1_MessageResultDesired = ResultDesired.TRUE;
        soaphandler1_FaultResultDesired = ResultDesired.TRUE;
        soaphandler2_MessageResultDesired = ResultDesired.TRUE;
        soaphandler2_FaultResultDesired = ResultDesired.TRUE;
        logicalhandler1_MessageResultDesired = ResultDesired.TRUE;
        logicalhandler1_FaultResultDesired = ResultDesired.PROTOCOL_EXCEPTION;
        logicalhandler2_MessageResultDesired = ResultDesired.TRUE;
        logicalhandler2_FaultResultDesired = ResultDesired.TRUE;

        HandlerChainProcessor processor = new HandlerChainProcessor(handlers, Protocol.soap11);
        MessageContext mc1 = new MessageContext();
        mc1.setMEPContext(new MEPContext(mc1));
        Exception e = null;
        try {
            // notice all handlers are closed in this scenario, and we get an exception
            processor.processFault(mc1.getMEPContext(), HandlerChainProcessor.Direction.IN);
        } catch (ProtocolException pe) {
            e = pe;
        }

        assertNotNull(e);
        assertEquals("S2f:S1f:L1f:S2c:S1c:L1c:L2c:", result);
    }
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public boolean handleFault(SOAPMessageContext messagecontext) {
    result = result.concat("S1f:");
    if (soaphandler1_FaultResultDesired == ResultDesired.TRUE)
        return true;
    else if (soaphandler1_FaultResultDesired == ResultDesired.FALSE)
        return false;
    else if (soaphandler1_FaultResultDesired == ResultDesired.PROTOCOL_EXCEPTION)
        throw new ProtocolException();
    else if (soaphandler1_FaultResultDesired == ResultDesired.OTHER_EXCEPTION)
        throw new RuntimeException();

    // default
    return true;
}
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public boolean handleMessage(SOAPMessageContext messagecontext) {
    result = result.concat("S1m:");
    if (soaphandler1_MessageResultDesired == ResultDesired.TRUE)
        return true;
    else if (soaphandler1_MessageResultDesired == ResultDesired.FALSE)
        return false;
    else if (soaphandler1_MessageResultDesired == ResultDesired.PROTOCOL_EXCEPTION)
        throw new ProtocolException();
    else if (soaphandler1_MessageResultDesired == ResultDesired.OTHER_EXCEPTION)
        throw new RuntimeException();

    // default
    return true;
}
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public boolean handleFault(SOAPMessageContext messagecontext) {
    result = result.concat("S2f:");
    if (soaphandler2_FaultResultDesired == ResultDesired.TRUE)
        return true;
    else if (soaphandler2_FaultResultDesired == ResultDesired.FALSE)
        return false;
    else if (soaphandler2_FaultResultDesired == ResultDesired.PROTOCOL_EXCEPTION)
        throw new ProtocolException();
    else if (soaphandler2_FaultResultDesired == ResultDesired.OTHER_EXCEPTION)
        throw new RuntimeException();

    // default
    return true;
}
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public boolean handleMessage(SOAPMessageContext messagecontext) {
    result = result.concat("S2m:");
    if (soaphandler2_MessageResultDesired == ResultDesired.TRUE)
        return true;
    else if (soaphandler2_MessageResultDesired == ResultDesired.FALSE)
        return false;
    else if (soaphandler2_MessageResultDesired == ResultDesired.PROTOCOL_EXCEPTION)
        throw new ProtocolException();
    else if (soaphandler2_MessageResultDesired == ResultDesired.OTHER_EXCEPTION)
        throw new RuntimeException();

    // default
    return true;
}
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public boolean handleFault(LogicalMessageContext messagecontext) {
    result = result.concat("L1f:");
    if (logicalhandler1_FaultResultDesired == ResultDesired.TRUE)
        return true;
    else if (logicalhandler1_FaultResultDesired == ResultDesired.FALSE)
        return false;
    else if (logicalhandler1_FaultResultDesired == ResultDesired.PROTOCOL_EXCEPTION)
        throw new ProtocolException();
    else if (logicalhandler1_FaultResultDesired == ResultDesired.OTHER_EXCEPTION)
        throw new RuntimeException();

    // default
    return true;
}
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public boolean handleMessage(LogicalMessageContext messagecontext) {
    result = result.concat("L1m:");
    if (logicalhandler1_MessageResultDesired == ResultDesired.TRUE)
        return true;
    else if (logicalhandler1_MessageResultDesired == ResultDesired.FALSE)
        return false;
    else if (logicalhandler1_MessageResultDesired == ResultDesired.PROTOCOL_EXCEPTION)
        throw new ProtocolException();
    else if (logicalhandler1_MessageResultDesired == ResultDesired.OTHER_EXCEPTION)
        throw new RuntimeException();

    // default
    return true;
}
项目:wso2-axis2    文件:HandlerChainProcessorTests.java   
public boolean handleFault(LogicalMessageContext messagecontext) {
    result = result.concat("L2f:");
    if (logicalhandler2_FaultResultDesired == ResultDesired.TRUE)
        return true;
    else if (logicalhandler2_FaultResultDesired == ResultDesired.FALSE)
        return false;
    else if (logicalhandler2_FaultResultDesired == ResultDesired.PROTOCOL_EXCEPTION)
        throw new ProtocolException();
    else if (logicalhandler2_FaultResultDesired == ResultDesired.OTHER_EXCEPTION)
        throw new RuntimeException();

    // default
    return true;
}