/** * Create a sample synapse message context with a simple payload * * @param payload payload of the envelope of message context * @return Axis2MessageContext with payload and parameters * @throws Exception on creating the context */ private Axis2MessageContext getMessageContext(String payload) throws Exception { Map<String, Entry> properties = new HashMap<>(); Axis2MessageContext messageContext = TestUtils.getAxis2MessageContext(payload, properties); messageContext.getAxis2MessageContext().setTransportIn(new TransportInDescription("http")); return messageContext; }
/** * Clone the MessageContext * @param oldMsg * @return * @throws AxisFault */ public static MessageContext cloneMessageContext (MessageContext oldMsg) throws AxisFault { MessageContext newMsg = new MessageContext (); newMsg.setOptions(new Options (oldMsg.getOptions())); // Create a copy of the envelope SOAPEnvelope oldEnvelope = oldMsg.getEnvelope(); if (oldEnvelope != null) { SOAPEnvelope newEnvelope = copySOAPEnvelope(oldMsg.getEnvelope()); newMsg.setEnvelope(newEnvelope); } newMsg.setConfigurationContext(oldMsg.getConfigurationContext()); newMsg.setAxisService(oldMsg.getAxisService()); newMsg.setTransportOut(oldMsg.getTransportOut()); newMsg.setTransportIn(oldMsg.getTransportIn()); //Copy property objects from oldMsg to newMsg copyConfiguredProperties(oldMsg,newMsg); return newMsg; }
msgContext.setTransportIn(transportIn); msgContext.setTransportOut(transportOut); msgContext.setServerSide(true);
/** * Create a new axis MessageContext for an incoming message through this transport * @return the newly created message context */ public MessageContext createMessageContext() { MessageContext msgCtx = new MessageContext(); msgCtx.setConfigurationContext(cfgCtx); msgCtx.setIncomingTransportName(getTransportName()); msgCtx.setTransportOut(transportOut); msgCtx.setTransportIn(transportIn); msgCtx.setServerSide(true); msgCtx.setMessageID(UIDGenerator.generateURNString()); // There is a discrepency in what I thought, Axis2 spawns a nes threads to // send a message is this is TRUE - and I want it to be the other way msgCtx.setProperty(MessageContext.CLIENT_API_NON_BLOCKING, Boolean.valueOf(!isNonBlocking)); // are these relevant? //msgCtx.setServiceGroupContextId(UUIDGenerator.getUUID()); // this is required to support Sandesha 2 //msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, // new HttpCoreRequestResponseTransport(msgContext)); return msgCtx; }
/** * Create a new axis MessageContext for an incoming message through this transport * @return the newly created message context */ public MessageContext createMessageContext() { MessageContext msgCtx = new MessageContext(); msgCtx.setConfigurationContext(cfgCtx); msgCtx.setIncomingTransportName(getTransportName()); msgCtx.setTransportOut(transportOut); msgCtx.setTransportIn(transportIn); msgCtx.setServerSide(true); msgCtx.setMessageID(UIDGenerator.generateURNString()); // There is a discrepency in what I thought, Axis2 spawns a nes threads to // send a message is this is TRUE - and I want it to be the other way msgCtx.setProperty(MessageContext.CLIENT_API_NON_BLOCKING, Boolean.valueOf(!isNonBlocking)); // are these relevant? //msgCtx.setServiceGroupContextId(UUIDGenerator.getUUID()); // this is required to support Sandesha 2 //msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, // new HttpCoreRequestResponseTransport(msgContext)); return msgCtx; }
msgCtx.setTransportIn(inMessageContext.getTransportIn()); msgCtx.setTransportOut(inMessageContext.getTransportOut()); msgCtx.setServerSide(false); AxisMessage inMessage = axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE); msgCtx.setAxisMessage(inMessage); msgCtx.setTransportIn(inMessageContext.getTransportIn()); msgCtx.setTransportOut(inMessageContext.getTransportOut()); msgCtx.setServerSide(false);
private MessageContext getNewMessageContextUsingAxis2Info(CreateSequenceMessage createSequenceMessage) throws AxisFault, RMMessageBuildingException { MessageContext messageContext = new MessageContext(); messageContext.setServiceContext(this.axis2Info.getServiceContext()); messageContext.setEnvelope(createSequenceMessage.toSOAPEnvelope()); messageContext.setMessageID(UUIDGenerator.getUUID()); messageContext.setTransportIn(this.axis2Info.getTransportIn()); messageContext.setTransportOut(this.axis2Info.getTransportOut()); messageContext.setReplyTo(this.ackToEpr); messageContext.setProperty(MercuryConstants.PROCESS_RM_CONTROL_MESSAGE, Constants.VALUE_TRUE); messageContext.setOptions(new Options()); // set the correct options messageContext.getOptions().setTo(this.axis2Info.getOptions().getTo()); messageContext.getOptions().setUseSeparateListener(this.axis2Info.getOptions().isUseSeparateListener()); messageContext.setServerSide(this.axis2Info.isServerSide()); return messageContext; }
messageContext.setProperty(SMSTransportConstents.SEND_TO , sender); messageContext.setProperty(SMSTransportConstents.DESTINATION , receiver); messageContext.setTransportIn(in); messageContext.setTransportOut(out); handleSMSProperties(msg , messageContext);
responseMsgCtx.setTransportIn(transportIn);
responseMsgCtx.setTransportIn(transportIn);
newMC.setTransportIn(mc.getTransportIn()); newMC.setTransportOut(mc.getTransportOut()); newMC.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
msgCtx.setTransportIn(tIn); msgCtx.setTransportOut(localTransportResOut); msgCtx.setProperty(MessageContext.TRANSPORT_OUT, response);
newMC.setTransportIn(mc.getTransportIn()); newMC.setTransportOut(mc.getTransportOut()); newMC.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
responseMessageContext.setTransportIn(msgContext.getTransportIn()); responseMessageContext.setTransportOut(msgContext.getTransportOut()); handleResponse(responseMessageContext);
responseMessageContext.setTransportIn(msgContext.getTransportIn()); responseMessageContext.setTransportOut(msgContext.getTransportOut()); handleResponse(responseMessageContext);
responseMessageContext.setTransportIn(msgContext.getTransportIn()); responseMessageContext.setTransportOut(msgContext.getTransportOut()); handleResponse(responseMessageContext);
/** * Create a empty message context * * @return A context with empty message * @throws AxisFault on an error creating a context */ private MessageContext createMessageContext() throws AxisFault { Axis2SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(new SynapseConfiguration()); org.apache.axis2.context.MessageContext axis2MC = new org.apache.axis2.context.MessageContext(); axis2MC.setConfigurationContext(new ConfigurationContext(new AxisConfiguration())); ServiceContext svcCtx = new ServiceContext(); OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx); axis2MC.setServiceContext(svcCtx); axis2MC.setOperationContext(opCtx); axis2MC.setTransportIn(new TransportInDescription("http")); axis2MC.setTo(new EndpointReference("http://localhost:9000/services/SimpleStockQuoteService")); MessageContext mc = new Axis2MessageContext(axis2MC, new SynapseConfiguration(), synapseEnvironment); mc.setMessageID(UIDGenerator.generateURNString()); mc.setEnvelope(OMAbstractFactory.getSOAP12Factory().createSOAPEnvelope()); mc.getEnvelope().addChild(OMAbstractFactory.getSOAP12Factory().createSOAPBody()); return mc; } }
newmsgCtx.setTransportIn(inMessageContext.getTransportIn()); newmsgCtx.setTransportOut(inMessageContext.getTransportOut()); newmsgCtx.setServerSide(inMessageContext.isServerSide());
newmsgCtx.setTransportIn(inMessageContext.getTransportIn()); newmsgCtx.setTransportOut(inMessageContext.getTransportOut()); newmsgCtx.setServerSide(inMessageContext.isServerSide());
/** * Create a empty message context * * @return A context with empty message * @throws AxisFault on an error creating a context */ private MessageContext createMessageContext() throws AxisFault { Axis2SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(new SynapseConfiguration()); org.apache.axis2.context.MessageContext axis2MC = new org.apache.axis2.context.MessageContext(); axis2MC.setConfigurationContext(new ConfigurationContext(new AxisConfiguration())); ServiceContext svcCtx = new ServiceContext(); OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx); axis2MC.setServiceContext(svcCtx); axis2MC.setOperationContext(opCtx); axis2MC.setTransportIn(new TransportInDescription("http")); // axis2MC.setTo(new EndpointReference("http://localhost:9000/services/SimpleStockQuoteService")); MessageContext mc = new Axis2MessageContext(axis2MC, new SynapseConfiguration(), synapseEnvironment); mc.setMessageID(UIDGenerator.generateURNString()); mc.setEnvelope(OMAbstractFactory.getSOAP12Factory().createSOAPEnvelope()); mc.getEnvelope().addChild(OMAbstractFactory.getSOAP12Factory().createSOAPBody()); return mc; } }