webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Error "Failed to convert JSON to XML payload" in Mediator 9.12

  • 1.  Error "Failed to convert JSON to XML payload" in Mediator 9.12

    Posted Tue January 12, 2021 10:25 AM

    Hello everyone,

    I’m currently facing a an issue on a REST-API exposed in Mediator, with JSON Content. Details on the software version below.

    Whenever a client invokes our Web Service, the following error is presented:

    {
    "Exception": "Mediator encountered an error:Unable to invoke ESB Service:ab.mediator.cd.priv:copyCDRequest. Exception:Failed to convert JSON to XML payload.  while executing operation:validation-rules service:OmnichannelAPI_Voucherify at time:9:59:36 AM on date:Jan 12, 2021. The client ip was:12.34.5.67. The current user:Default. The consumer application:null"
    } 
    

    This happens when calling the aforementioned flow service, which is being called through the “Run webMethods Integration Server Service” policy, at the Request Level.

    To debug this situation, I have made a dynamic savePipelineToFile, but the request is not even reaching this flow service.

    I have investigated further, and I’ve reached the conclusion that only some types of requests fail, and I’ve pinpointed it to some specific characters, which I present below:

    The request below fails due to the characters that are highlighted, numbers and symbols like the dollar sign ($). I am aware that it is not standard to define numbers or symbols as the first character for a JSON Property Name, but this provider only has these fields available this way.

    I would like to ask you:

    1. Is this a know error with the product or configuration? Is there a fix or a configuration that can solve this?
    2. If no fix or solution is available, is there any way to workaround this?

    Software Information:
    webMethods Integration Server 9.12.0.0 with WmMediator
    IS_9.12_Core_Fix18 installed

    Thank you in advance for your help.

    Best Regards,

    Luís Monteiro


    #Integration-Server-and-ESB
    #API-Management
    #API-Gateway
    #webMethods


  • 2.  RE: Error "Failed to convert JSON to XML payload" in Mediator 9.12

    Posted Thu January 14, 2021 10:26 AM

    Hello,

    I was able to solve this problem. Below I’ll describe the process and actions taken:

    1. Activated Full Logging on the Virtual Service (Log Always, with Request and Response);
    2. In there, I was able to check that this error was being returned by the wsstack class, when trying to convert to XML, due to XML not accepting numbers and/or symbols as an element name (which is compliant with XML Rules/Norms);
    3. Apparently, when using wsstack, Mediator first tries to convert the JSON Request to XML before applying any of the other policies;
    4. Unpublished the Virtual Service;
    5. Changed CentraSite to axis-free mode in centrasite.xml;
    6. Restarted CentraSite;
    7. Published the Virtual Service again;
    8. After testing again, the Virtual Service was invoked and executed/run sucessfully.

    Hope this may help someone with the same problem in the future. :slight_smile:

    Best Regards,

    Luís Monteiro


    #webMethods
    #API-Gateway
    #Integration-Server-and-ESB
    #API-Management