// service.addChild(operation);
operation.setParent(service);
}
OperationContext operationContext = new OperationContext(operation);
newMessageContext.setOperationContext(operationContext);
operationContext.addMessageContext(newMessageContext);
// adding a blank envelope
SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(referenceMessage
.getEnvelope()));
newMessageContext.setEnvelope(factory.getDefaultEnvelope());
newMessageContext.setTransportIn(referenceMessage.getTransportIn());
newMessageContext.setTransportOut(referenceMessage.getTransportOut());
copyNecessaryPropertiesFromRelatedContext(referenceMessage, newMessageContext);
// copying transport info.
newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, referenceMessage
.getProperty(MessageContext.TRANSPORT_OUT));
newMessageContext.setProperty(Constants.OUT_TRANSPORT_INFO, referenceMessage
.getProperty(Constants.OUT_TRANSPORT_INFO));
newMessageContext.setProperty(MessageContext.TRANSPORT_HEADERS, referenceMessage
.getProperty(MessageContext.TRANSPORT_HEADERS));
newMessageContext.setProperty(MessageContext.TRANSPORT_IN, referenceMessage
.getProperty(MessageContext.TRANSPORT_IN));
newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, referenceMessage
.getProperty(MessageContext.TRANSPORT_OUT));
//copyint properties as configured in the module.xml properties. Module xml has several
//properties which gives comma seperated lists of property names that have to be copited
//from various places when creating related messages.
AxisModule axisModule = SandeshaUtil.getAxisModule();
Parameter propertiesFromRefMsg = axisModule.getParameter(Sandesha2Constants.propertiesToCopyFromReferenceMessage);
if (propertiesFromRefMsg!=null) {
String value = (String) propertiesFromRefMsg.getValue();
if (value!=null) {
value = value.trim();
String[] propertyNames = value.split(",");
for (int i=0;i<propertyNames.length;i++) {
String propertyName = propertyNames[i];
Object val = referenceMessage.getProperty(propertyName);
if (val!=null) {
newMessageContext.setProperty(propertyName,val);
}
}
}
}
Parameter propertiesFromRefReqMsg = axisModule.getParameter(Sandesha2Constants.propertiesToCopyFromReferenceRequestMessage);
OperationContext referenceOpCtx = referenceMessage.getOperationContext();
MessageContext referenceRequestMessage = null;
if (referenceOpCtx!=null)
referenceRequestMessage=referenceOpCtx.getMessageContext(OperationContextFactory.MESSAGE_LABEL_IN_VALUE);
if (propertiesFromRefReqMsg!=null && referenceRequestMessage!=null) {
String value = (String) propertiesFromRefReqMsg.getValue();
if (value!=null) {
value = value.trim();