Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

MQ Message Object Output

I have configured the IBM websphere mq in my virtual asset. My Input is BytesMessage, but Object Message Responder does not exist for virtualization incoming request. Which Message Responder should I choose?
I need convert input to Map<String, String>, then convert to BytesMessage after edit.What can I do for it?

Answers

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    The BytesMessage should be read and converted to a string by the responder. Are the bytes of the message XML or JSON or just a literal value? You could start with a literal responder and monitor the asset to see what message the responder receives.

  • danielzhou
    danielzhou Posts: 5
    edited January 2021

    Hi williammccusker
    When I start with a literal responder and run java in Extension Tool, error "Failed an attempt to report a request message" has happened.

    String byte2String(Object input, ScriptingContext context) {
        return input;
    }
    
  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    That code indicates the method should return a string however the variable input is an Object. What happens if you call "toString" on the input to make sure what it returns is in fact a String?

  • danielzhou
    danielzhou Posts: 5

    Hi,

    input is in fact a String. I take the Extension Tool in a response.

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    Do you have any more details from the error message? Using Event monitoring often gives more insight into what the error might be. From looking at the code example provided, if it is in fact Java, I would have expected a compile error since Java should force the code to explicitly cast the "input" to a String for the return. A scripting language like Groovy would not have a problem with that code.

  • danielzhou
    danielzhou Posts: 5

    I Think the MQServer's ccsid is IBM930, and defaultly Virtualize change to UTF-8. It make mistake. How can I set Virtualize's ccsid?
    https://forums.parasoft.com/discussion/5202/how-to-set-virtualize-settings#latest

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited February 2021

    I Think the MQServer's ccsid is IBM930, and defaultly Virtualize change to UTF-8. It make mistake

    It looks like you would pick x-IBM930 for the Outgoing Message Encoding in the Message Responder.

    From How to set Virtualize settings:

    Are you trying to control the CCSID that is being set in the "characterSet" field in the MQMD of response messages sent by Virtualize? This is controlled in the Message Responder under "Options > Outgoing Message Encoding". For example, choosing UTF-8 will result in the characterSet field being set to the CCSID of 1208. Or if you pick IBM037 (EBCDIC) then the characterSet field will be set to the CCSID of 37. What CCSID value are you trying to set?