Forum Discussion

camarar's avatar
camarar
Occasional Contributor
7 years ago

How to set a JMS Request to Payload Empty?

Hi Guys, 

 

I'm trying to build a test suite that send an JMS message with payload empty ( like JMS Message Type= Mesage or Simple).

 

I can connect correctly and send JMS messages that other types like byte, map and text.

 

Can you help-me how to send a JMS Message with no body?

 

 

 

  • I could not  to implement in SoapUI Request interface a JMS Message with JMS Type Simple.

     

    I wrote this code in Groovy to send this JMS Message.

     

    import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSConnectionHolder;
    import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils;
    import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint;
    import hermes.Hermes;
    import javax.jms.*;
    def jmsEndpoint = new JMSEndpoint("<JMS_ENDPOINT>");
    def hermes = HermesUtils.getHermes( context.testCase.testSuite.project, jmsEndpoint.sessionName);
    def jmsConnectionHolder = new JMSConnectionHolder( jmsEndpoint, hermes, false, null ,null ,null);
    Session queueSession = jmsConnectionHolder.getSession();
    Queue queueSend = jmsConnectionHolder.getQueue( jmsConnectionHolder.getJmsEndpoint().getSend() );
    Queue queueBrowse = jmsConnectionHolder.getQueue( jmsConnectionHolder.getJmsEndpoint().getReceive() );
    MessageProducer messageProducer =queueSession.createProducer( queueSend );

    //This part you create a message by JMS Type
    Message messageSend = queueSession.createMessage();

    // This part you can set a JMS Property
    messageSend.setBooleanProperty("<Property_Name>", true);
    messageSend.setStringProperty("<Property_Name>", "<VALUE>");

    messageProducer.send(messageSend);

     

  • camarar's avatar
    camarar
    Occasional Contributor

    I could not  to implement in SoapUI Request interface a JMS Message with JMS Type Simple.

     

    I wrote this code in Groovy to send this JMS Message.

     

    import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSConnectionHolder;
    import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils;
    import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint;
    import hermes.Hermes;
    import javax.jms.*;
    def jmsEndpoint = new JMSEndpoint("<JMS_ENDPOINT>");
    def hermes = HermesUtils.getHermes( context.testCase.testSuite.project, jmsEndpoint.sessionName);
    def jmsConnectionHolder = new JMSConnectionHolder( jmsEndpoint, hermes, false, null ,null ,null);
    Session queueSession = jmsConnectionHolder.getSession();
    Queue queueSend = jmsConnectionHolder.getQueue( jmsConnectionHolder.getJmsEndpoint().getSend() );
    Queue queueBrowse = jmsConnectionHolder.getQueue( jmsConnectionHolder.getJmsEndpoint().getReceive() );
    MessageProducer messageProducer =queueSession.createProducer( queueSend );

    //This part you create a message by JMS Type
    Message messageSend = queueSession.createMessage();

    // This part you can set a JMS Property
    messageSend.setBooleanProperty("<Property_Name>", true);
    messageSend.setStringProperty("<Property_Name>", "<VALUE>");

    messageProducer.send(messageSend);