/** * Constructor has package access * * @param configContext the associated ConfigurationContext */ MessageContext(ConfigurationContext configContext) { this(); setConfigurationContext(configContext); }
/** * Constructor has package access * * @param configContext the associated ConfigurationContext */ MessageContext(ConfigurationContext configContext) { this(); setConfigurationContext(configContext); }
public static MessageContext createMessageContext(OMElement payload, OMElement topic, int tenantId) throws EventBrokerException { MessageContext mc = new MessageContext(); mc.setConfigurationContext(new ConfigurationContext(new AxisConfiguration())); SuperTenantCarbonContext.getCurrentContext(mc).setTenantId(tenantId); SOAPFactory soapFactory = new SOAP12Factory(); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); envelope.getBody().addChild(payload); if (topic != null) { envelope.getHeader().addChild(topic); } try { mc.setEnvelope(envelope); } catch (Exception e) { throw new EventBrokerException("Unable to generate event.", e); } return mc; }
/** * 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; }
/** * 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; }
public static MessageContext createMessageContext(OMElement payload, OMElement topic, int tenantId) throws EventBrokerException { MessageContext mc = new MessageContext(); mc.setConfigurationContext(new ConfigurationContext(new AxisConfiguration())); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantId); SOAPFactory soapFactory = new SOAP12Factory(); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); envelope.getBody().addChild(payload); if (topic != null) { envelope.getHeader().addChild(topic); } try { mc.setEnvelope(envelope); } catch (Exception e) { throw new EventBrokerException("Unable to generate event.", e); } return mc; }
/** * 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; }
@Override protected void setUp() throws Exception { service = new AxisService(); outputStream = new ByteArrayOutputStream(); schemas = new ArrayList<XmlSchema>(); loadSampleSchemaFile(schemas); service.addSchema(schemas); AxisConfiguration axisConfiguration = new AxisConfiguration(); service.setName("test_service"); axisConfiguration.addChild(service); axisConfiguration.addService(service); configurationContext = new ConfigurationContext(axisConfiguration); configurationContext.setServicePath("test_service"); configurationContext.setContextRoot("test/context"); messageContext.setConfigurationContext(configurationContext); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(); envelope.getBody().addChild(createOMElement("<sendEmail/>")); testCtx.setEnvelope(envelope); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(); envelope.getBody().addChild(createOMElement("<describeSObjects/>")); testCtx.setEnvelope(envelope); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(); envelope.getBody().addChild(createOMElement("<queryResponse>" + "<result>" + "<done>false</done><queryLocator>01g9000000MVzggAAD-200</queryLocator>" + "<size>370</size>" + "</result>" + "</queryResponse>")); testCtx.setEnvelope(envelope); }
private MessageContext createMessageContext(String payload, String action) { try { SynapseConfiguration synapseConfig = new SynapseConfiguration(); AxisConfiguration axisConfig = new AxisConfiguration(); synapseConfig.setAxisConfiguration(axisConfig); ConfigurationContext cfgCtx = new ConfigurationContext(axisConfig); SynapseEnvironment env = new Axis2SynapseEnvironment(cfgCtx, synapseConfig); axisConfig.addParameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfig); axisConfig.addParameter(SynapseConstants.SYNAPSE_ENV, env); MessageContext msgCtx = TestUtils.getAxis2MessageContext(payload, null). getAxis2MessageContext(); msgCtx.setConfigurationContext(cfgCtx); msgCtx.setTo(new EndpointReference(SUB_MAN_URL)); msgCtx.setWSAAction(action); return msgCtx; } catch (Exception e) { fail(); } return null; } }
/** * 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; } }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext)testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(); envelope.getBody().addChild(createOMElement("<original>test-split-context</original>")); testCtx.setEnvelope(envelope); testCtx.setSoapAction("urn:test"); SequenceMediator seqMed = new SequenceMediator(); helperMediator = new SplitTestHelperMediator(); helperMediator.init(testCtx.getEnvironment()); seqMed.addChild(helperMediator); testCtx.getConfiguration().addSequence("seqRef", seqMed); testCtx.getConfiguration().addSequence("main", new SequenceMediator()); testCtx.getConfiguration().addSequence("fault", new SequenceMediator()); }
/** * 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); 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; }
/** * 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); 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; } }
/** * 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; } }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment( new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext(). setConfigurationContext(new ConfigurationContext(config)); SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(); testCtx.setEnvelope(envelope); testCtx.setSoapAction("urn:test"); SequenceMediator seqMed = new SequenceMediator(); helperMediator = new ForEachHelperMediator(); helperMediator.init(testCtx.getEnvironment()); seqMed.addChild(helperMediator); SequenceMediator seqMedInvalid = new SequenceMediator(); SendMediator sendMediator = new SendMediator(); sendMediator.init(testCtx.getEnvironment()); seqMedInvalid.addChild(sendMediator); testCtx.getConfiguration().addSequence("seqRef", seqMed); testCtx.getConfiguration().addSequence("seqRefInvalid", seqMedInvalid); testCtx.getConfiguration().addSequence("main", new SequenceMediator()); testCtx.getConfiguration().addSequence("fault", new SequenceMediator()); testCtx.setEnvelope(envelope); }