Forum Discussion

nmowbray's avatar
nmowbray
Occasional Contributor
6 years ago

set JMSReplyTo Header with Groovy

Hi, 

 

I am trying to set the JMSReplyTo header through soapUI but i keep getting an error, i am trying to send to a specific queue that we had created for our test.  What we are doing is we send a request into the request queue but we want the response sent to a specific queue that we can use groovy to pull the message of that queue to verify the correct response is returned.

 

Here is how we have the groovy code: 

 

// Send Request
def String webLogicInitialContextFactory = "weblogic.jndi.WLInitialContextFactory";
def String jmsServerUrl = context.expand( '${#Project#jmsServerUrl}' );
def String jndiQueueConnectionFactory = 'jms/resourceFacingServiceActivationRequest/connectionfactory'

def String jndiQueue = 'jms/resourceFacingServiceActivationRequest/queue'
def String jndiResponseQueueCi = 'jms/ci_resourceFacingServiceActivationResponse/queue'
def String username = context.expand( '${#Project#jmsUsername}' );
def String password = context.expand( '${#Project#jmsPassword}' );

def queue = new WeblogicJmsQueue(webLogicInitialContextFactory,
jmsServerUrl,
username,
password,
jndiQueueConnectionFactory,
jndiQueue);


// ask the session for a text message object
def msg = queue.qsession.createTextMessage();
def transId = context.expand('${nonunique_properties#transId}')
def payload = context.expand( '${Read Test#Execute}' ) + '\n';

//msg.setJMSCorrelationId(transId)
msg.setJMSDeliveryMode(2)
msg.setJMSExpiration(System.currentTimeMillis() + 5*1000)
msg.setJMSMessageID()
msg.setJMSPriority(4)
msg.setJMSTimestamp(System.currentTimeMillis())
msg.setJMSType()
if (jndiResponseQueueCi != ''){
msg.setJMSReplyTo(jndiResponseQueueCi)}
msg.setStringProperty("X_SHAW_TRANSACTION_ID", transId)
msg.setStringProperty("X_SHAW_ONBEHALFOF_ID", "")
msg.setStringProperty("X_SHAW_ORIGINATING_USER_ID", "SJRB'\'proctst_matrix_oem")
msg.setStringProperty("X_SHAW_ORIGINATING_IP_ADDRESS", "10.15.185.25")
msg.setStringProperty("X_SHAW_ORIGINATING_HOST_NAME", "devcoreoeml006.matrix.SJRB.AD")
msg.setStringProperty("X_SHAW_ORIGINAL_MODULE_ID", "NetCracker")
msg.setText(payload);
queue.sendMessage(msg);

log.info("JMS Message Sent: $payload")
queue.close();

log.info "Succesfully sent to $jmsServerUrl";

 

Error Message i get when attempting to send the request this way: 

 

groovy.lang.MissingMethodException: No signature of method: weblogic.jms.common.TextMessageImpl.setJMSReplyTo() is applicable for argument types: (java.lang.String) values: [jms/ci_resourceFacingServiceActivationResponse/queue] Possible solutions: setJMSReplyTo(javax.jms.Destination), getJMSReplyTo() error at line: 46

 

No RepliesBe the first to reply