Package org.apache.axis2.engine

Examples of org.apache.axis2.engine.MessageReceiver


        }
        return null;
    }
   
    private MessageReceiver loadDefaultMessageReceiver(String mepURL, AxisService service) {
        MessageReceiver messageReceiver;
        if (mepURL == null) {
            mepURL = WSDL2Constants.MEP_URI_IN_OUT;
        }
        if (service != null) {
            messageReceiver = service.getMessageReceiver(mepURL);
View Full Code Here


                    axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY);
                } else {
                    axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT);
                }

                MessageReceiver msgrec = null;
                if (op.isNonBlocking()) {
                    msgrec = new Axis2ServiceInMessageReceiver(this, op, policyHandlerList);
                } else {
                    msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op, policyHandlerList);
                }
View Full Code Here

                }
            }

            workerPool.execute( new Runnable() {
                public void run() {
                    MessageReceiver mr = mc.getAxisOperation().getMessageReceiver();
                    try {
                        // This AxisFault is created to create the fault message context
                        // noinspection ThrowableInstanceNeverThrown
                        AxisFault axisFault = exceptionToRaise != null ?
                                new AxisFault(errorMessage, exceptionToRaise) :
                                new AxisFault(errorMessage);

                        MessageContext nioFaultMessageContext =
                            MessageContextBuilder.createFaultMessageContext(mc, axisFault);

                        SOAPEnvelope envelope = nioFaultMessageContext.getEnvelope();

                        if (log.isDebugEnabled()) {
                            log.debug("Sending Fault for Request with Message ID : "
                                    + mc.getMessageID());
                        }
                       
                        nioFaultMessageContext.setProperty(
                            NhttpConstants.SENDING_FAULT, Boolean.TRUE);
                        nioFaultMessageContext.setProperty(
                                NhttpConstants.ERROR_MESSAGE, errorMessage);
                        if (errorCode != -1) {
                            nioFaultMessageContext.setProperty(
                                NhttpConstants.ERROR_CODE, errorCode);
                        }
                        if (exceptionToRaise != null) {
                            nioFaultMessageContext.setProperty(
                                NhttpConstants.ERROR_DETAIL, exceptionToRaise.toString());
                            nioFaultMessageContext.setProperty(
                                NhttpConstants.ERROR_EXCEPTION, exceptionToRaise);
                            envelope.getBody().getFault().getDetail().setText(
                                exceptionToRaise.toString());
                        } else {
                            nioFaultMessageContext.setProperty(
                                NhttpConstants.ERROR_DETAIL, errorMessage);
                            envelope.getBody().getFault().getDetail().setText(errorMessage);
                        }
                        nioFaultMessageContext.setProperty(CLIENT_CONNECTION_DEBUG,
                            mc.getProperty(CLIENT_CONNECTION_DEBUG));
                        mr.receive(nioFaultMessageContext);

                    } catch (AxisFault af) {
                        log.error("Unable to report back failure to the message receiver", af);
                    }
                }
View Full Code Here

                // client. Should / would be ignored by any transport other than
                // nhttp. For example, JMS would not send a reply message for one-way
                // operations.
                MessageContext outMsgCtx =
                        (MessageContext) context.getAttribute(OUTGOING_MESSAGE_CONTEXT);
                MessageReceiver mr = outMsgCtx.getAxisOperation().getMessageReceiver();

                // the following check is to support the dual channel invocation. Hence the
                // response will be sent as a new request to the client over a different channel
                // client sends back a 202 Accepted response to synapse and we need to neglect that
                // 202 Accepted message
                if (!outMsgCtx.isPropertyTrue(NhttpConstants.IGNORE_SC_ACCEPTED)) {

                    try {
                        MessageContext responseMsgCtx = outMsgCtx.getOperationContext().
                                getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
                        if (responseMsgCtx == null ||
                                outMsgCtx.getOptions().isUseSeparateListener() ||
                                outMsgCtx.getOperationContext().isComplete()) {
                            if (responseMsgCtx != null &&
                                    responseMsgCtx.getProperty("synapse.send") == null) {
                                return;
                            }
                        } else if (responseMsgCtx == null ||
                                outMsgCtx.getOptions().isUseSeparateListener()) {
                            // Since we need to notify the SynapseCallback receiver to remove the
                            // call backs registered  we set a custom property
                            setHeaders(context, response, outMsgCtx, responseMsgCtx);
                            outMsgCtx.setProperty(NhttpConstants.HTTP_202_RECEIVED, "true");
                            mr.receive(outMsgCtx);
                            return;
                        }

                        if (responseMsgCtx == null) {
                            return;
                        }
                        setHeaders(context, response, outMsgCtx, responseMsgCtx);
                        responseMsgCtx.setServerSide(true);
                        responseMsgCtx.setDoingREST(outMsgCtx.isDoingREST());
                        responseMsgCtx.setProperty(MessageContext.TRANSPORT_IN,
                                outMsgCtx.getProperty(MessageContext.TRANSPORT_IN));
                        responseMsgCtx.setTransportIn(outMsgCtx.getTransportIn());
                        responseMsgCtx.setTransportOut(outMsgCtx.getTransportOut());

                        responseMsgCtx.setAxisMessage(outMsgCtx.getAxisOperation().
                                getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
                        responseMsgCtx.setOperationContext(outMsgCtx.getOperationContext());
                        responseMsgCtx.setConfigurationContext(outMsgCtx.getConfigurationContext());
                        responseMsgCtx.setTo(null);

                        if (!outMsgCtx.isDoingREST() && !outMsgCtx.isSOAP11()) {
                            responseMsgCtx.setEnvelope(OMAbstractFactory.getSOAP12Factory().getDefaultEnvelope());
                        } else {
                            responseMsgCtx.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
                        }
                        responseMsgCtx.setProperty(AddressingConstants.
                                DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
                        responseMsgCtx.setProperty(NhttpConstants.SC_ACCEPTED, Boolean.TRUE);
                        mr.receive(responseMsgCtx);

                    } catch (org.apache.axis2.AxisFault af) {
                        log.debug("Unable to report back " +
                                "202 Accepted state to the message receiver");
                    }
View Full Code Here

        MessageContext context = storageManager.retrieveMessageContext(messageStoreKey, configCtx);
       
        AxisOperation axisOperation = context.getAxisOperation();
        if (axisOperation != null) {
         
          MessageReceiver msgReceiver = axisOperation.getMessageReceiver();
          if ((msgReceiver != null) && (msgReceiver instanceof CallbackReceiver)) {
           
            Object callback = ((CallbackReceiver)msgReceiver).lookupCallback(context.getMessageID());
            if (callback instanceof Callback) {
              try {
                ((CallbackReceiver)msgReceiver).addCallback(context.getMessageID(),(Callback)callback);
              } catch (AxisFault axisFault) {
                throw new SandeshaException(axisFault);
              }
             
            ((Callback)callback).onError(fault);
            } else if(callback instanceof AxisCallback) {
              try {
                ((CallbackReceiver)msgReceiver).addCallback(context.getMessageID(),(AxisCallback)callback);
              } catch (AxisFault axisFault) {
                throw new SandeshaException(axisFault);
              }
             
              ((AxisCallback)callback).onError(fault);
            }
           // this is actually to support synapse. Synpase Axis Operation does not have a callBackMessageReceiver
                     // synapse AxisOperation always has the synapse message receiver. And also to be send in the synapse
                     // fault mediators we need to set the SENDING_FAULT property as well.
                    } else if (msgReceiver != null && tempBean.getMessageType() == Sandesha2Constants.MessageTypes.APPLICATION) {
                        try {
                            //since there is no reponse we set this message as the fault reply
                            context.getOptions().setRelationships(new RelatesTo[]{new RelatesTo(context.getMessageID())});
                            context.setProperty("SENDING_FAULT", Boolean.TRUE);
                            msgReceiver.receive(context);
                        } catch (AxisFault axisFault) {
                            log.error(axisFault.getMessage());
                            throw new SandeshaException("Can not invoke the message receiver ", axisFault);
                        }
                    }
View Full Code Here

        oldRMSBean.setReallocated(Sandesha2Constants.WSRM_COMMON.REALLOCATION_FAILED);
        storageManager.getRMSBeanMgr().update(oldRMSBean);
        throw new SandeshaException(SandeshaMessageKeys.reallocationForSyncRequestReplyNotSupported);
      } else {
        MessageReceiver msgReceiver = axisOperation.getMessageReceiver();
        Object callback = ((CallbackReceiver)msgReceiver).lookupCallback(msgCtx.getMessageID())
        client.setAxisService(msgCtx.getAxisService());
        client.sendReceiveNonBlocking(msgCtx.getEnvelope().getBody().cloneOMElement().getFirstElement(), (Callback)callback);
      }
    }
View Full Code Here

                    axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY);
                } else {
                    axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT);
                }

                MessageReceiver msgrec = null;
                if (op.isNonBlocking()) {
                    msgrec = new Axis2ServiceInMessageReceiver(this, op);
                } else {
                    msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op);
                }
View Full Code Here

public class SoapHeaderTest extends Axis2TestBase {

    public void testSimplePassing() throws Exception {
        server.deployService("TestSoapHeader", "dummy-service.wsdl",
                new QName("http://axis2.ode.apache.org", "DummyService"), "DummyServiceSOAP11port_http",
                new MessageReceiver() {
            public void receive(MessageContext messageCtx) throws AxisFault {
                OMElement cidElmt = messageCtx.getEnvelope().getHeader().getFirstElement();
                assertEquals("ConversationId", cidElmt.getLocalName());
                assertEquals("ZZZXYZ", cidElmt.getText());
View Full Code Here

                    axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY);
                } else {
                    axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT);
                }

                MessageReceiver msgrec = null;
                TuscanyServiceProvider serviceProvider = new TuscanyServiceProvider(extensionPoints, endpoint, wsBinding, op);
                if (op.isNonBlocking()) {
                    msgrec = new Axis2ServiceInMessageReceiver(serviceProvider);
                } else {
                    msgrec = new Axis2ServiceInOutSyncMessageReceiver(serviceProvider);
View Full Code Here

                    axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY);
                } else {
                    axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT);
                }

                MessageReceiver msgrec = null;
                if (op.isNonBlocking()) {
                    msgrec = new Axis2ServiceInMessageReceiver(this, op, policyHandlerList);
                } else {
                    msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op, policyHandlerList);
                }
View Full Code Here

TOP

Related Classes of org.apache.axis2.engine.MessageReceiver

Copyright © 2018 www.massapicom. 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.