Forum Discussion

omrzljak's avatar
omrzljak
Occasional Contributor
15 years ago

[RESOLVED]Correlating messages (request/response) using JMS support

Hello,

I am very happy with JMS support (icw HermesJMS) in Soapui. I am using it with WebSphere MQ (6 and 7) and it works wel (in some cases).

My question is how can I configure correlation of request and response messages?
I am using Soapui as mq web service client. Soapui puts a request message in request queue and listens for response message o reply queue. But it those not correlate messages, it reads first message from de reply queue as response. So when I have more threads in test case there is no guaranty on which thread gets which response. In other JMS clients (also not JMS clients) we use correlatinid when consuming response (like explained in http://www.eaipatterns.com/RequestReplyJmsExample.html ).

This means that we must be able to specify message selector in soapui in such a way that jmscorrelationid = requestmessage.messageid.

Any idea how to solve this without changing Java Source of soapui.

18 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi ,

    can you explain more  , what you want to achieve.

    Regards
    Nebojsa
    eviware.com
  • Jeff_Mason's avatar
    Jeff_Mason
    Occasional Contributor
    i am testing an asychronous message wherein the subsequent server responses are directly put in the queue. The way we correlate the request/response is by setting applicationContext\correlationId to the unique ID. This server response to my asycn message is in the Payload area. Since the server was the one putting the message in the queue, I will not know the JMSMessageID of the response. I would like to setup a test step to be able to de-queue the server response using the applicationContext\correlationId as a filter. Is this possible?


    E.g.
    ---------

     

         
            ABC
            User1
            12-NX00734353
            99945
         

     

     

     
      ...
     
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    so , if I understood you correctly, you know the correlationID but it is not placed in JMSCorrelationID  Header.
    Message selector need something to resolve to true or false so you can use this to filter messages

    '${JMSTestStep#Response#//Envelope[1]/Header[1]/applicationContext[1]/correlationId[1]}'='12-NX00734353'


    Let us know does this helps

    regards
    nebojsa
    eviware.com
  • Jeff_Mason's avatar
    Jeff_Mason
    Occasional Contributor
    i put the code on the Message Selector:

    '${JMSTestStep#Response#//Envelope[1]/Header[1]/applicationContext[1]/correlationId[1]}'='12-NX00734353'

    However, when i run it, i got an error:

    Wed Apr 21 11:22:49 NZST 2010:ERROR:org.apache.xmlbeans.XmlException: error: Unexpected end of file after null
      org.apache.xmlbeans.XmlException: error: Unexpected end of file after null
      at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)
      at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:712)
      at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:696)
      at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:683)
      at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208)
      at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:580)
      at com.eviware.soapui.model.propertyexpansion.resolvers.ResolverUtils.extractXPathPropertyValue(ResolverUtils.java:92)
      at com.eviware.soapui.model.propertyexpansion.resolvers.ModelItemPropertyResolver.resolveProperty(ModelItemPropertyResolver.java:90)
      at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:159)
      at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(PropertyExpander.java:92)
      at com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext.expand(WsdlTestRunContext.java:146)
      at com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestReceiveTransport.execute(HermesJmsRequestReceiveTransport.java:43)
      at com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestTransport.sendRequest(HermesJmsRequestTransport.java:96)
      at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:122)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Caused by: org.xml.sax.SAXParseException: Unexpected end of file after null
      at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)
      at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
      at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454)
      ... 19 more


    I've attached some screenshots of what i'm trying to do. Hope it helps clarify my question.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    sorry I was wrong. In Message Selector you can only use JMS headers or JMS Properties values and not the payload.
    So the line of code I've sent you is not right.

    So either the server has to put correlationID value to JMSCorrelationID Header or you need to browse through the queue and do some groovy scripting to find out the JMSMessageID of message that has proper correlationId in payload and use that JMSMessageID for message selector.

    Regards
    Nebojsa
    eviware.com
  • Hi All,

    I have a similar problem where I am using adding a RequestID = 123456789 using the JMS property. Now I want the respective response for my request with the same RequestID using (RequestID='${=context.getProperty("JMS_MESSAGE_SEND").getRequestID()}' using Message Selector)
    But it fails with the below error message .... Please let me know if any thing I am doing wrong on this.


    Wed May 16 15:59:06 EDT 2012:ERROR:Error evaluating script
    groovy.lang.MissingMethodException: No signature of method: com.ibm.ws.sib.api.jms.impl.JmsBytesMessageImpl.getRequestID() is applicable for argument types: () values: []
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
    at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at Script8.run(Script8.groovy:1)
    at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
    at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.doEval(EvalPropertyResolver.java:191)
    at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.resolveProperty(EvalPropertyResolver.java:170)
    at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:172)
    at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(PropertyExpander.java:100)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext.expand(WsdlTestRunContext.java:146)
    at com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestSendReceiveTransport.execute(HermesJmsRequestSendReceiveTransport.java:47)
    at com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestTransport.sendRequest(HermesJmsRequestTransport.java:95)
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
  • Hi ,

    Just to verify one more query
    Please let me know if the "context.getProperty("JMS_MESSAGE_SEND")" used above what is the "JMS_MESSAGE_SEND" here??

    Thanks,
    manoj