• 1 reply
  • Latest Post - ‏2012-04-13T13:08:27Z by swlinn
6 Posts

Pinned topic MPGW -> JSON / RESTful

‏2012-04-13T11:49:49Z |
i have the following issue:

I would like to configure a MPGW for a RESTful / JSON Service. I understood, that i have to configure JSON as Request/Response Type, to configure "Process Messages Whose Body Is Empty", and to use the JSON2JSONX Transformer in convert-http when i want to process the message. In fact i want to implement an AAA Rule so i have to make the JSON2JSONX conversion. RESTful / JSON Services have quite often "empty messages" which is also for my case a fact.

Here is the problem:

The JSON2JSONX Transformation fails, when the message is empty:
"Unable to parse JSON and generate JSONx: Incomplete markup or missing document element at offset 39 of http"

Is there any misunderstanding on my site or has anyone any idea what's the solution?

Updated on 2012-04-13T13:08:27Z at 2012-04-13T13:08:27Z by swlinn
  • swlinn
    1398 Posts

    Re: MPGW -> JSON / RESTful

    If you have the request message type as JSON, the conversion to JSONx happens automatically with the result stored in the __JSONASJSONX (that's two underscores) context. It could be that the HTTP Convert action with the JSON encoding, being an explicit action that you're doing, isn't looking at the empty message configuration. You could open a PMR on that to get an official response if that is a defect or a by design behavior, but in the meantime, since you have the conversion in the special context, you could just to the HTTP Convert without the encoding and use the special context ,ie dp:variable(var://context/__JSONASJSONX) to access the JSONx if available.