}
public Message invokeRequest(Message tuscanyMsg) {
try {
// get the jms context
JMSBindingContext context = tuscanyMsg.getBindingContext();
javax.jms.Message jmsMsg = tuscanyMsg.getBody();
Operation operation = tuscanyMsg.getOperation();
String operationName = operation.getName();
RuntimeComponentReference reference = (RuntimeComponentReference)runtimeWire.getSource().getContract();
// I think the OASIS spec suggests we do not need to do anything with
// @nativeOperation here on the reference side.
requestMessageProcessor.setOperationName(operationName, jmsMsg);
if (jmsBinding.getOperationJMSDeliveryMode(operationName) != null) {
if (jmsBinding.getOperationJMSDeliveryMode(operationName)) {
jmsMsg.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
} else {
jmsMsg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
}
}
if (jmsBinding.getOperationJMSCorrelationId(operationName) != null) {
jmsMsg.setJMSCorrelationID(jmsBinding.getOperationJMSCorrelationId(operationName));
}
if (jmsBinding.getOperationJMSPriority(operationName) != null) {
jmsMsg.setJMSPriority(jmsBinding.getOperationJMSPriority(operationName));
}
if (jmsBinding.getOperationJMSType(operationName) != null) {
jmsMsg.setJMSType(jmsBinding.getOperationJMSType(operationName));
}
ReferenceParameters parameters = tuscanyMsg.getFrom().getReferenceParameters();
Object conversationID = parameters.getConversationID();
if (conversationID != null) {
jmsMsg.setStringProperty(JMSBindingConstants.CONVERSATION_ID_PROPERTY, conversationID.toString());
}
if (tuscanyMsg.getFrom().getCallbackEndpoint() != null) {
if (parameters.getCallbackID() != null) {
jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY, parameters.getCallbackID().toString());
}
String callbackDestName = getCallbackDestinationName(reference);
if (callbackDestName != null) {
jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, callbackDestName);
}
}
for (String propName : jmsBinding.getPropertyNames()) {
Object value = jmsBinding.getProperty(propName);
jmsMsg.setObjectProperty(propName, value);
}
Map<String, Object> operationProperties = jmsBinding.getOperationProperties(operationName);
if (operationProperties != null) {
for (String propName : operationProperties.keySet()) {
Object value = operationProperties.get(propName);
jmsMsg.setObjectProperty(propName, value);
}
}
if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
context.setTimeToLive(jmsBinding.getOperationJMSTimeToLive(operationName) * 2);
} else {
context.setTimeToLive(JMSBindingConstants.DEFAULT_TIME_TO_LIVE);
}
return tuscanyMsg;
} catch (JMSException e) {
throw new JMSBindingException(e);