Forum Discussion

asn_007's avatar
asn_007
Contributor
7 years ago

Error : illegal character 'R' at offset 0 when sending an XML message to JMS Queue

Hi,

 

I have written a groovy script which creates an xml file and then tries to send the created xml to a JMS queue.

but I am seeing an exception(in my application's log which reads : "illegal character 'R' at offset 0"

I followed the steps mentioned here(used Byte instead of Text) : https://www.soapui.org/jms/working-with-jms-messages.html

 

When I tried to copy the created xml and posted the same through RFHUTILC, I don't see any error.

 

Sample of what I tried to do :

def jmsEndpoint = new JMSEndpoint("jms://MQSession::QueueName")
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 );
BytesMessage textMessageSend = queueSession.createBytesMessage();

 

< my XML creation code goes here which I have captured in the var updatedXml >

 

textMessageSend.writeUTF(updatedXml);
messageProducer.send(textMessageSend);

 

7 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Full stack trace please (with reference to the respective line numbers from the script)?
    • asn_007's avatar
      asn_007
      Contributor

      Hi nmrao

       

      The script doesn't throw any error.

      The SOPAUI log has the below line if it helps "JMS Endpoint String does not contain a parameter at index 2, parameters: [MQSession, MyQueueName]

       

      Thanks

      A

      • nmrao's avatar
        nmrao
        Champion Level 3

        Try changing below statement:

         

        def jmsEndpoint = new JMSEndpoint("jms://MQSession::QueueName")

         

        to

         

        def jmsEndpoint = new JMSEndpoint("jms://${session}::${channelType}_${send}::${channelType}_${receive}")

         

        session is MQSession

        channelType is queue or topic

        send is Name of the queue to which message has to be send

        receive is Name of the queue on which it receives response