private static void fillSOAPEnvelope(MessageContext messageContext, OMElement xmlPayload, ServiceClient serviceClient) throws AxisFault { messageContext.setServiceContext(serviceClient.getServiceContext()); SOAPFactory soapFactory = getSOAPFactory(serviceClient.getOptions()); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); if (xmlPayload != null) { envelope.getBody().addChild(xmlPayload); } serviceClient.addHeadersToEnvelope(envelope); messageContext.setEnvelope(envelope); }
/** * same as OutInAxisOperationClient */ public void addMessageContext(MessageContext mc) throws AxisFault { mc.setServiceContext(sc); if (mc.getMessageID() == null) { setMessageID(mc); } axisOp.registerOperationContext(mc, oc); }
/** * same as OutInAxisOperationClient */ public void addMessageContext(MessageContext mc) throws AxisFault { mc.setServiceContext(sc); if (mc.getMessageID() == null) { setMessageID(mc); } axisOp.registerOperationContext(mc, oc); }
/** * Prepare a SOAP envelope with the stuff to be sent. * * @param messageContext the message context to be filled * @param xmlPayload the payload content * @throws AxisFault if something goes wrong */ private void fillSOAPEnvelope(MessageContext messageContext, OMElement xmlPayload) throws AxisFault { messageContext.setServiceContext(serviceContext); SOAPFactory soapFactory = getSOAPFactory(); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); if (xmlPayload != null) { envelope.getBody().addChild(xmlPayload); } addHeadersToEnvelope(envelope); messageContext.setEnvelope(envelope); }
/** * Adds message context to operation context, so that it will handle the * logic correctly if the OperationContext is null then new one will be * created, and Operation Context will become null when some one calls reset(). * * @param msgContext the MessageContext to add * @throws AxisFault */ public void addMessageContext(MessageContext msgContext) throws AxisFault { msgContext.setServiceContext(sc); if (msgContext.getMessageID() == null) { setMessageID(msgContext); } axisOp.registerOperationContext(msgContext, oc); }
/** * Copied from {@link ServiceClient} */ protected void fillSOAPEnvelope(final MessageContext messageContext, final OMElement xmlPayload) throws AxisFault { messageContext.setServiceContext(getServiceContext()); final SOAPFactory soapFactory = getSOAPFactory(); final SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); if (xmlPayload != null) { envelope.getBody().addChild(xmlPayload); } addHeadersToEnvelope(envelope); messageContext.setEnvelope(envelope); }
/** * Prepare a SOAP envelope with the stuff to be sent. * * @param messageContext the message context to be filled * @param xmlPayload the payload content * @throws AxisFault if something goes wrong */ private void fillSOAPEnvelope(MessageContext messageContext, OMElement xmlPayload) throws AxisFault { messageContext.setServiceContext(serviceContext); SOAPFactory soapFactory = getSOAPFactory(); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); if (xmlPayload != null) { envelope.getBody().addChild(xmlPayload); } addHeadersToEnvelope(envelope); messageContext.setEnvelope(envelope); }
/** * Adds message context to operation context, so that it will handle the logic correctly if the OperationContext * is null then new one will be created, and Operation Context will become null when some one calls reset(). * * @param msgContext the MessageContext to add * @throws AxisFault */ @Override public void addMessageContext(final MessageContext msgContext) throws AxisFault { msgContext.setServiceContext(sc); if (msgContext.getMessageID() == null) { setMessageID(msgContext); } axisOp.registerOperationContext(msgContext, oc); }
/** * Adds message context to operation context, so that it will handle the * logic correctly if the OperationContext is null then new one will be * created, and Operation Context will become null when some one calls reset(). * * @param msgContext the MessageContext to add * @throws AxisFault */ public void addMessageContext(MessageContext msgContext) throws AxisFault { msgContext.setServiceContext(sc); if (msgContext.getMessageID() == null) { setMessageID(msgContext); } axisOp.registerOperationContext(msgContext, oc); }
/** * Adds a message context to the client for processing. This method must not * process the message - it only records it in the MEP client. Processing * only occurs when execute() is called. * * @param mc the message context * @throws AxisFault if this is called inappropriately. */ public void addMessageContext(MessageContext mc) throws AxisFault { if (this.mc != null) { throw new AxisFault(Messages.getMessage("cannotaddmsgctx")); } this.mc = mc; if (mc.getMessageID() == null) { setMessageID(mc); } mc.setServiceContext(sc); axisOp.registerOperationContext(mc, oc); this.completed = false; }
/** * Adds a message context to the client for processing. This method must not * process the message - it only records it in the MEP client. Processing * only occurs when execute() is called. * * @param mc the message context * @throws AxisFault if this is called inappropriately. */ public void addMessageContext(MessageContext mc) throws AxisFault { if (this.mc != null) { throw new AxisFault(Messages.getMessage("cannotaddmsgctx")); } this.mc = mc; if (mc.getMessageID() == null) { setMessageID(mc); } mc.setServiceContext(sc); axisOp.registerOperationContext(mc, oc); this.completed = false; }
private void fillSOAPEnvelope(MessageContext messageContext, OMElement xmlPayload) throws AxisFault { messageContext.setServiceContext(getServiceContext()); SOAPFactory soapFactory = getSOAPFactory(); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); if (xmlPayload != null) { envelope.getBody().addChild(xmlPayload); } addHeadersToEnvelope(envelope); messageContext.setEnvelope(envelope); }
/** * @param context The OperationContext */ public void setOperationContext(OperationContext context) { // allow setting the fields to null // useful when extracting the messge context from the object graph operationContext = context; this.setParent(operationContext); if (operationContext != null) { if (serviceContext == null) { setServiceContext(operationContext.getServiceContext()); } else { if (operationContext.getParent() != serviceContext) { throw new AxisError("ServiceContext in OperationContext does not match !"); } } this.setAxisOperation(operationContext.getAxisOperation()); } }
private void createAndFillContexts(AxisService service, MessageContext msgContext, SessionContext sessionContext) throws AxisFault { ServiceGroupContext serviceGroupContext; AxisServiceGroup axisServiceGroup = service.getAxisServiceGroup(); ConfigurationContext configCtx = msgContext.getConfigurationContext(); serviceGroupContext = configCtx.createServiceGroupContext(axisServiceGroup); msgContext.setServiceGroupContext(serviceGroupContext); ServiceContext serviceContext = serviceGroupContext.getServiceContext(service); msgContext.setServiceContext(serviceContext); if (sessionContext != null) { sessionContext.addServiceContext(serviceContext); sessionContext.addServiceGroupContext(serviceGroupContext); } }
private void createAndFillContexts(AxisService service, MessageContext msgContext, SessionContext sessionContext) throws AxisFault { ServiceGroupContext serviceGroupContext; AxisServiceGroup axisServiceGroup = service.getAxisServiceGroup(); ConfigurationContext configCtx = msgContext.getConfigurationContext(); serviceGroupContext = configCtx.createServiceGroupContext(axisServiceGroup); msgContext.setServiceGroupContext(serviceGroupContext); ServiceContext serviceContext = serviceGroupContext.getServiceContext(service); msgContext.setServiceContext(serviceContext); if (sessionContext != null) { sessionContext.addServiceContext(serviceContext); sessionContext.addServiceGroupContext(serviceGroupContext); } }
/** * @param context The OperationContext */ public void setOperationContext(OperationContext context) { // allow setting the fields to null // useful when extracting the messge context from the object graph operationContext = context; this.setParent(operationContext); if (operationContext != null) { if (serviceContext == null) { setServiceContext(operationContext.getServiceContext()); } else { if (operationContext.getParent() != serviceContext) { throw new AxisError("ServiceContext in OperationContext does not match !"); } } this.setAxisOperation(operationContext.getAxisOperation()); } }
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; }
protected MessageContext send(ClientOptions options, AxisMessage message, QName operationQName, boolean block, String resultMessageLabel) throws Exception { OperationClient mepClient = serviceClient.createClient(operationQName); MessageContext mc = new MessageContext(); mc.setProperty(Constants.Configuration.MESSAGE_TYPE, message.getMessageType()); mc.setEnvelope(message.getEnvelope()); Attachments attachments = message.getAttachments(); if (attachments != null) { mc.setAttachmentMap(attachments); mc.setDoingSwA(true); mc.setProperty(Constants.Configuration.ENABLE_SWA, true); } for (AxisTestClientConfigurator configurator : configurators) { configurator.setupRequestMessageContext(mc); } mc.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, options.getCharset()); mc.setServiceContext(serviceClient.getServiceContext()); if (metrics != null) { mc.setProperty(BaseConstants.METRICS_COLLECTOR, metrics); } mepClient.addMessageContext(mc); mepClient.execute(block); // mepClient.complete(mc); return resultMessageLabel == null ? null : mepClient.getMessageContext(resultMessageLabel); }
/** * 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; }