Package org.apache.ode.bpel.iapi

Examples of org.apache.ode.bpel.iapi.PartnerRoleMessageExchange.replyWithFailure()


            Operation opDef = odeMex.getOperation();
            BindingOperation opBinding = portBinding.getBindingOperation(opDef.getName(), opDef.getInput().getName(), opDef.getOutput().getName());
            if (opDef.getFaults().isEmpty()) {
                errmsg = "Operation has no fault. This 500 error will be considered as a failure.";
                if (log.isDebugEnabled()) log.debug(errmsg);
                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
            } else if (opBinding.getBindingFaults().isEmpty()) {
                errmsg = "No fault binding. This 500 error will be considered as a failure.";
                if (log.isDebugEnabled()) log.debug(errmsg);
                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
            } else if (method.getResponseBodyAsStream() == null) {
View Full Code Here


                if (log.isDebugEnabled()) log.debug(errmsg);
                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
            } else if (opBinding.getBindingFaults().isEmpty()) {
                errmsg = "No fault binding. This 500 error will be considered as a failure.";
                if (log.isDebugEnabled()) log.debug(errmsg);
                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
            } else if (method.getResponseBodyAsStream() == null) {
                errmsg = "No body in the response. This 500 error will be considered as a failure.";
                if (log.isDebugEnabled()) log.debug(errmsg);
                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
            } else {
View Full Code Here

                if (log.isDebugEnabled()) log.debug(errmsg);
                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
            } else if (method.getResponseBodyAsStream() == null) {
                errmsg = "No body in the response. This 500 error will be considered as a failure.";
                if (log.isDebugEnabled()) log.debug(errmsg);
                odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
            } else {
                final InputStream bodyAsStream = method.getResponseBodyAsStream();
                try {
                    Element bodyEl = DOMUtils.parse(bodyAsStream).getDocumentElement();
                    QName bodyName = new QName(bodyEl.getNamespaceURI(), bodyEl.getNodeName());
View Full Code Here

                    // is this fault bound with ODE extension?
                    if (!WsdlUtils.isOdeFault(opBinding.getBindingFault(faultDef.getName()))) {
                        errmsg = "Fault " + bodyName + " is not bound with " + new QName(Namespaces.ODE_HTTP_EXTENSION_NS, "fault") + ". This 500 error will be considered as a failure.";
                        if (log.isDebugEnabled()) log.debug(errmsg);
                        odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
                    } else {
                        Part partDef = (Part) faultDef.getMessage().getParts().values().iterator().next();

                        // build the element to be sent back
                        Document odeMsg = DOMUtils.newDocument();
View Full Code Here

                        odeMex.replyWithFault(faultType, response);
                    }
                } catch (Exception e) {
                    errmsg = "Unable to parse the response body as xml. This 500 error will be considered as a failure.";
                    if (log.isDebugEnabled()) log.debug(errmsg, e);
                    odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method, false));
                }
            }

        }
View Full Code Here

        private void _4xx_badRequest() throws IOException {
           PartnerRoleMessageExchange odeMex = (PartnerRoleMessageExchange) server.getEngine().getMessageExchange(mexId);
            String errmsg = "Bad Request! " + method.getStatusLine();
            log.error(errmsg);
            odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
        }

        private void _3xx_redirection() throws IOException {
            PartnerRoleMessageExchange odeMex = (PartnerRoleMessageExchange) server.getEngine().getMessageExchange(mexId);
            String errmsg = "Redirections are not supported! " + method.getStatusLine();
View Full Code Here

        private void _3xx_redirection() throws IOException {
            PartnerRoleMessageExchange odeMex = (PartnerRoleMessageExchange) server.getEngine().getMessageExchange(mexId);
            String errmsg = "Redirections are not supported! " + method.getStatusLine();
            log.error(errmsg);
            odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
        }

        private void _2xx_success() {
            PartnerRoleMessageExchange odeMex = (PartnerRoleMessageExchange) server.getEngine().getMessageExchange(mexId);
            if (log.isDebugEnabled()) log.debug("Http Status Line=" + method.getStatusLine());
View Full Code Here

            try {
                final InputStream bodyAsStream = method.getResponseBodyAsStream();
                if (isBodyMandatory && bodyAsStream == null) {
                    String errmsg = "Response body is mandatory but missing! Msg Id=" + odeMex.getMessageExchangeId();
                    log.error(errmsg);
                    odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, null);
                } else {
                    javax.wsdl.Message outputMessage = odeMex.getOperation().getOutput().getMessage();
                    Message odeResponse = odeMex.createMessage(outputMessage.getQName());

                    // handle the body if any
View Full Code Here

                            Element partElement = httpMethodConverter.createPartElement(part, bodyElement);
                            odeResponse.setPart(part.getName(), partElement);
                        } catch (Exception e) {
                            String errmsg = "Unable to parse the response body: " + e.getMessage();
                            log.error(errmsg, e);
                            odeMex.replyWithFailure(MessageExchange.FailureType.FORMAT_ERROR, errmsg, null);
                            return;
                        }
                    }

                    // handle headers
View Full Code Here

                            log.info("Response:\n" + DOMUtils.domToString(odeResponse.getMessage()));
                        odeMex.reply(odeResponse);
                    } catch (Exception ex) {
                        String errmsg = "Unable to process response: " + ex.getMessage();
                        log.error(errmsg, ex);
                        odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
                    }
                }
            } catch (IOException e) {
                String errmsg = "Unable to get the request body : " + e.getMessage();
                log.error(errmsg, e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.