}
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();
RuntimeEndpointReference reference = runtimeWire;
// 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.getEffectiveJMSDeliveryMode(operationName) != null) {
if (jmsBinding.getEffectiveJMSDeliveryMode(operationName)) {
jmsMsg.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
} else {
jmsMsg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
}
}
if (jmsBinding.getEffectiveJMSPriority(operationName) != null) {
jmsMsg.setJMSPriority(jmsBinding.getEffectiveJMSPriority(operationName));
}
if ( jmsBinding.getEffectiveJMSType(operationName) != null ) {
jmsMsg.setJMSType(jmsBinding.getEffectiveJMSType(operationName));
}
if ( jmsBinding.getEffectiveJMSTimeToLive(operationName) != null ) {
jmsMsg.setJMSExpiration(jmsBinding.getEffectiveJMSTimeToLive(operationName));
}
if (jmsBinding.getOperationJMSCorrelationId(operationName) != null) {
jmsMsg.setJMSCorrelationID(jmsBinding.getOperationJMSCorrelationId(operationName));
} else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equals(jmsBinding.getCorrelationScheme())) {
jmsMsg.setJMSCorrelationID(UUID.randomUUID().toString());
}
if (tuscanyMsg.getFrom().getCallbackEndpoint() != null) {
String callbackDestName = getCallbackDestinationName(reference);
if (callbackDestName != null) {
jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, "jms:jndi:" + callbackDestName);
if (operation.isNonBlocking()) {
Destination dest = context.getJmsResourceFactory().lookupDestination(callbackDestName);
jmsMsg.setJMSReplyTo(dest);
}
}
}
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.getEffectiveJMSTimeToLive(operationName) != null) {
context.setTimeToLive(jmsBinding.getEffectiveJMSTimeToLive(operationName) * 2);
} else {
context.setTimeToLive(JMSBindingConstants.DEFAULT_TIME_TO_LIVE);
}
return tuscanyMsg;
} catch (JMSException e) {
throw new JMSBindingException(e);