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

  • williammccuskerwilliammccusker Posts: 528 ✭✭✭

    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.

  • danielzhoudanielzhou Posts: 5
    edited January 8

    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;
    }
    
  • williammccuskerwilliammccusker Posts: 528 ✭✭✭

    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?

  • danielzhoudanielzhou Posts: 5

    Hi,

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

  • williammccuskerwilliammccusker Posts: 528 ✭✭✭

    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.

  • danielzhoudanielzhou 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_parasoftbenken_parasoft Posts: 1,018 ✭✭✭
    edited February 8

    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?

Sign In or Register to comment.