Topic
  • 5 replies
  • Latest Post - ‏2014-01-06T06:05:33Z by SKG
SKG
SKG
46 Posts

Pinned topic SLM not working for JSON request

‏2013-12-23T08:09:31Z |

My request type is JSON and there is a requirement to throttle the requests. Now in my MPGW when I set my request type to JSON and simply pass my request to backend(Match All followed by Return) and get a response. So far so good. I now introduce a SLM node after Match All with high values for throttling. Now when I send a single request I get Internal error message. In the log it says - illegal character '{' at offset 0. However my input is perfectly valid JSON. If I change my input request type to non-XML then everything works fine. However my query is why SLM does not work with JSON request type. Content-Type Header is set to application/json.

  • HermannSW
    HermannSW
    4736 Posts

    Re: SLM not working for JSON request

    ‏2013-12-23T12:29:41Z  

    The error message states that DataPower tries to parse your JSON input as XML, which it does not do with Non-XML request type.

    Please use Non-XML request type as workaround and create a PMR.
     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/> <myFrameless/>

  • SKG
    SKG
    46 Posts

    Re: SLM not working for JSON request

    ‏2013-12-30T11:51:42Z  

    The problem with having only a non-xml flow type is that JSON validation is not performed. Hence solved the problem by having two flows. Flow 1 is type non-xml with SLM and calls flow 2. flow 2 is type json with no slm.

  • HermannSW
    HermannSW
    4736 Posts

    Re: SLM not working for JSON request

    ‏2013-12-30T18:45:23Z  
    • SKG
    • ‏2013-12-30T11:51:42Z

    The problem with having only a non-xml flow type is that JSON validation is not performed. Hence solved the problem by having two flows. Flow 1 is type non-xml with SLM and calls flow 2. flow 2 is type json with no slm.

    Nice workaround -- please do not forget to create a PMR on SLM with JSON request type not working.


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/> <myFrameless/>

  • SKG
    SKG
    46 Posts

    Re: SLM not working for JSON request

    ‏2013-12-31T08:16:46Z  
    • HermannSW
    • ‏2013-12-30T18:45:23Z

    Nice workaround -- please do not forget to create a PMR on SLM with JSON request type not working.


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/> <myFrameless/>

    I spoke regarding this issue to the trainer who had come to give my team the training on DP - he said that DP stores the JSON data as JSONX in the variable __JSONASJSONX. Hence in the SLM input if I change my INPUT type to __JSONASJSONX it will work. I tested this and it works. However this would still require me to save the previous input in another variable and feed that variable as input to the next node after the SLM node. This behavior is exclusive to JSON only.

    Updated on 2013-12-31T08:18:43Z at 2013-12-31T08:18:43Z by SKG
  • SKG
    SKG
    46 Posts

    Re: SLM not working for JSON request

    ‏2014-01-06T06:05:33Z  
    • HermannSW
    • ‏2013-12-30T18:45:23Z

    Nice workaround -- please do not forget to create a PMR on SLM with JSON request type not working.


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/> <myFrameless/>

    PMR Raised.