public Message processRequest(Message msg) {
return invokeRequest( msg );
} // end method processRequest
public Message processResponse(Message msg) {
JMSBindingContext context = msg.getBindingContext();
try {
Session session = context.getJmsResponseSession();
//javax.jms.Message requestJMSMsg = context.getJmsMsg();
javax.jms.Message responseJMSMsg = msg.getBody();
//Destination replyDest = requestJMSMsg.getJMSReplyTo();
Destination replyDest = context.getReplyToDestination();
if (replyDest == null) {
if (jmsBinding.getResponseDestinationName() != null) {
try {
replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName());
} catch (NamingException e) {
throw new JMSBindingException("Exception lookingup response destination", e);
}
}
} // end if
if (replyDest == null) {
// assume no reply is expected
if (msg.getBody() != null) {
logger.log(Level.FINE, "JMS service '" + service.getName() + "' dropped response as request has no replyTo");
}
return msg;
} // end if
if ((msg.getOperation() != null)) {
String operationName = msg.getOperation().getName();
if (jmsBinding.getEffectiveJMSPriority(operationName) != null) {
responseJMSMsg.setJMSPriority(jmsBinding.getEffectiveJMSPriority(operationName));
}
if ( jmsBinding.getEffectiveJMSType(operationName) != null) {
responseJMSMsg.setJMSType(jmsBinding.getEffectiveJMSType(operationName));
}
if ((jmsBinding.getEffectiveJMSDeliveryMode(operationName) != null)) {
responseJMSMsg.setJMSDeliveryMode(jmsBinding.getEffectiveJMSDeliveryMode(operationName) ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
}
if ((jmsBinding.getEffectiveJMSTimeToLive(operationName) != null)) {
responseJMSMsg.setJMSExpiration(jmsBinding.getEffectiveJMSTimeToLive(operationName).longValue());
}
}
/*
if (correlationScheme == null ||
JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
} else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) {
responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID());
}
*/
MessageProducer producer = session.createProducer(replyDest);
// Set jms header attributes in producer, not message.
//int deliveryMode = requestJMSMsg.getJMSDeliveryMode();
//producer.setDeliveryMode(deliveryMode);
//int deliveryPriority = requestJMSMsg.getJMSPriority();
//producer.setPriority(deliveryPriority);
//long timeToLive = requestJMSMsg.getJMSExpiration();
//producer.setTimeToLive(timeToLive);
producer.send((javax.jms.Message)msg.getBody());
producer.close();
return msg;
} catch (JMSException e) {
throw new JMSBindingException(e);
} finally {
context.closeJmsResponseSession();
} // end try
} // end method processResponse