Ask a Question

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

asn_007
Contributor

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 7
nmrao
Community Hero

Full stack trace please (with reference to the respective line numbers from the script)?


Regards,
Rao.

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
Community Hero

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



Regards,
Rao.

@nmrao The error remains the same. I have copied below the exception log form my application's logging.

I have renamed some of the names below.

 

<RecoverableException>
<Function>mpgw_nameOf the EG</Function>
<Type>Multiprotocol Gateway</Type>
<Name/>
<Label/>
<Catalog>Datapower</Catalog>
<Severity>3</Severity>
<Number>0x00030001</Number>
<Text>illegal character 'R' at offset 0 of dpmq://dpmq_Eai/fsh_MQ_Name?RequestQueue=QueueName</Text>
</RecoverableException>

nmrao
Community Hero

Re-iterating that it is not helpful unless full stack trace is posted (need to have match lines of the script as well)

Hope you are trying to send a soap request, right?


Regards,
Rao.

@nmrao That is all I had to show what error I could see.

The script doesn't throw any error. 

 

I am posting a simple xml to a queue.

When I copy & post the same xml which was generated by the script, through RFHUTIL, I dont see any errors in my app logging.

I skipped the Groovy steps to send to the queue and instead updated the generated xml in the Request tab, but still the same issue

When I copy the xml from the Request tab, create an xml file using notepad & post this file through rfhutilc, there is no error at all.

 

Has it got anything to do with the editor ? encoding ?

 

cancel
Showing results for 
Search instead for 
Did you mean: