Topic
  • 13 replies
  • Latest Post - ‏2013-11-12T20:07:26Z by kenhygh
prabhatrathore
prabhatrathore
9 Posts

Pinned topic JSON message validation

‏2013-07-30T06:18:02Z |

DataPower Firmware : XI52.5.0.0.0

The MPG  Request Type is set to JSON.

The below message( which is actually not correct ,  please notice the trailing  comma  after the last element) is passing the MPG successfully. 

{
"Name": "fdfdfdffdfdd",
"EmpId": 121211,
}

Since this is invalid JSON it should fail at the MPG level itself.

Any  suggestions ?????

Updated on 2013-07-30T07:16:19Z at 2013-07-30T07:16:19Z by prabhatrathore
  • HermannSW
    HermannSW
    6065 Posts
    ACCEPTED ANSWER

    Re: JSON message validation

    ‏2013-07-30T08:30:18Z  

    Hello Prabat,

    you should really not be on 5.0.0.0 firmware, many critical APARs have been fixed since then.
    If you run into any of those issues you will have to upgrade anyway.

    You are right, this is a bug.please create a PMR.

    The spec (http://www.ietf.org/rfc/rfc4627.txt) clearly shows that value-separator cannot be the last in a JSON object and DataPower should reject as invalid JSON

    
    object = begin-object [ member *( value-separator member ) ] end-object
    

     

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

     

     

  • Miel
    Miel
    50 Posts

    Re: JSON message validation

    ‏2013-07-30T08:26:31Z  

    Hi Prabhat,

                      Datapower checks oly  the well-formedness of the JSON msg , it will not validate the JSON data.

    The validation of the JSON data's are done manually by converting JSON into JSONX, after that we can validate the JSONX data with the help of store://jsonx.xsd schema file.

     

    Regards,

    Miel.

  • HermannSW
    HermannSW
    6065 Posts

    Re: JSON message validation

    ‏2013-07-30T08:30:18Z  

    Hello Prabat,

    you should really not be on 5.0.0.0 firmware, many critical APARs have been fixed since then.
    If you run into any of those issues you will have to upgrade anyway.

    You are right, this is a bug.please create a PMR.

    The spec (http://www.ietf.org/rfc/rfc4627.txt) clearly shows that value-separator cannot be the last in a JSON object and DataPower should reject as invalid JSON

    
    object = begin-object [ member *( value-separator member ) ] end-object
    

     

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

     

     

  • swlinn
    swlinn
    1395 Posts

    Re: JSON message validation

    ‏2013-07-30T14:51:07Z  
    • Miel
    • ‏2013-07-30T08:26:31Z

    Hi Prabhat,

                      Datapower checks oly  the well-formedness of the JSON msg , it will not validate the JSON data.

    The validation of the JSON data's are done manually by converting JSON into JSONX, after that we can validate the JSONX data with the help of store://jsonx.xsd schema file.

     

    Regards,

    Miel.

    Just a FYI, firmware V6.0.0 introduces the ability to validate the JSON data similar to a .xsd for XML

    Regards,

    Steve

  • Miel
    Miel
    50 Posts

    Re: JSON message validation

    ‏2013-07-31T02:46:16Z  
    • swlinn
    • ‏2013-07-30T14:51:07Z

    Just a FYI, firmware V6.0.0 introduces the ability to validate the JSON data similar to a .xsd for XML

    Regards,

    Steve

    Hi Steve,

                  Thanks for your update on this. I have read DP firmware V6.0.0 supports JSON as a message format without converting to JSONX.

    Can you give me some more input on this ?

     

     

    Regards,

    Miel.

  • HermannSW
    HermannSW
    6065 Posts

    Re: JSON message validation

    ‏2013-07-31T13:07:47Z  
    • Miel
    • ‏2013-07-31T02:46:16Z

    Hi Steve,

                  Thanks for your update on this. I have read DP firmware V6.0.0 supports JSON as a message format without converting to JSONX.

    Can you give me some more input on this ?

     

     

    Regards,

    Miel.

    Hi Madhu,

    v6.0 firmware allows to do JSON Schema validation (see article) as well as JSON transformations by JSONiq.

    There is no need for JSON2JSONX or JSONX2JSON transformations anymore, if you do not want.

    Find more informatiuon in this v6.0 InfoCenter page:
    http://pic.dhe.ibm.com/infocenter/wsdatap/v6r0m0/index.jsp?topic=%2Fcom.ibm.dp.xi.doc%2Fjson_jsonexamples.html

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE

  • Miel
    Miel
    50 Posts

    Re: JSON message validation

    ‏2013-08-01T03:18:34Z  
    • HermannSW
    • ‏2013-07-31T13:07:47Z

    Hi Madhu,

    v6.0 firmware allows to do JSON Schema validation (see article) as well as JSON transformations by JSONiq.

    There is no need for JSON2JSONX or JSONX2JSON transformations anymore, if you do not want.

    Find more informatiuon in this v6.0 InfoCenter page:
    http://pic.dhe.ibm.com/infocenter/wsdatap/v6r0m0/index.jsp?topic=%2Fcom.ibm.dp.xi.doc%2Fjson_jsonexamples.html

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE

    Hi Hermann,

                 Thanks for your feeds. 

  • prabhatrathore
    prabhatrathore
    9 Posts

    Re: JSON message validation

    ‏2013-08-14T02:43:47Z  
    • HermannSW
    • ‏2013-07-30T08:30:18Z

    Hello Prabat,

    you should really not be on 5.0.0.0 firmware, many critical APARs have been fixed since then.
    If you run into any of those issues you will have to upgrade anyway.

    You are right, this is a bug.please create a PMR.

    The spec (http://www.ietf.org/rfc/rfc4627.txt) clearly shows that value-separator cannot be the last in a JSON object and DataPower should reject as invalid JSON

    
    object = begin-object [ member *( value-separator member ) ] end-object
    

     

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

     

     

    Thanks Herman for your response. 

    PMR has been raised for this.

  • tallurisri
    tallurisri
    105 Posts

    Re: JSON message validation

    ‏2013-11-12T17:43:17Z  
    • HermannSW
    • ‏2013-07-31T13:07:47Z

    Hi Madhu,

    v6.0 firmware allows to do JSON Schema validation (see article) as well as JSON transformations by JSONiq.

    There is no need for JSON2JSONX or JSONX2JSON transformations anymore, if you do not want.

    Find more informatiuon in this v6.0 InfoCenter page:
    http://pic.dhe.ibm.com/infocenter/wsdatap/v6r0m0/index.jsp?topic=%2Fcom.ibm.dp.xi.doc%2Fjson_jsonexamples.html

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE

    Hi Hermann,

     

    I am trying to develop restful web service in DataPower XI52 v6, I am using transform action in processing rule to add request header can you please guide me how I can do this with out adding JSON to JSONx conversion. 

    One more doubt I have..from "JSON as request and response types" article in DataPower v6 infocenter : In DataPower® services, you can specify JSON as the request type or the response type. Specify JSON as the message type if you want to process the message as JSONx.

    Where I can specify JSON as the message type?

    Your help is appreciated.

    Thank you,

    Sri.

     

  • kenhygh
    kenhygh
    2033 Posts

    Re: JSON message validation

    ‏2013-11-12T18:00:04Z  

    Hi Hermann,

     

    I am trying to develop restful web service in DataPower XI52 v6, I am using transform action in processing rule to add request header can you please guide me how I can do this with out adding JSON to JSONx conversion. 

    One more doubt I have..from "JSON as request and response types" article in DataPower v6 infocenter : In DataPower® services, you can specify JSON as the request type or the response type. Specify JSON as the message type if you want to process the message as JSONx.

    Where I can specify JSON as the message type?

    Your help is appreciated.

    Thank you,

    Sri.

     

    You can set your header in a stylesheet by having the input context to your transform action be NULL instead of INPUT.

    You specify the message type on the main page of the multiprotocol gateway.

  • tallurisri
    tallurisri
    105 Posts

    Re: JSON message validation

    ‏2013-11-12T18:18:47Z  
    • kenhygh
    • ‏2013-11-12T18:00:04Z

    You can set your header in a stylesheet by having the input context to your transform action be NULL instead of INPUT.

    You specify the message type on the main page of the multiprotocol gateway.

    Hi Kenhygh,

    Thanks for your help, I changed input context to NULL my service working now.

    Still  iam confused with message type on the main page. Is it request/response type or any other option available along with request/response type option?

    Thank you,

    Sri. 

  • kenhygh
    kenhygh
    2033 Posts

    Re: JSON message validation

    ‏2013-11-12T18:32:45Z  

    Hi Kenhygh,

    Thanks for your help, I changed input context to NULL my service working now.

    Still  iam confused with message type on the main page. Is it request/response type or any other option available along with request/response type option?

    Thank you,

    Sri. 

    Request Type: the datatype of what comes IN to DataPower from the requestor. 

    Response Type: the datatype of the response from the backend server.

    They do not have to be the same.

  • tallurisri
    tallurisri
    105 Posts

    Re: JSON message validation

    ‏2013-11-12T19:15:25Z  
    • kenhygh
    • ‏2013-11-12T18:32:45Z

    Request Type: the datatype of what comes IN to DataPower from the requestor. 

    Response Type: the datatype of the response from the backend server.

    They do not have to be the same.

    Hi Kenhygh,

    Yes I agree with you. We can see these options on the main page of MPGW.

    Along with these options is there any option like "message type" available on the main page of MPGW?

     

    Thank you,

    Sri. 

     

  • kenhygh
    kenhygh
    2033 Posts

    Re: JSON message validation

    ‏2013-11-12T20:07:26Z  

    Hi Kenhygh,

    Yes I agree with you. We can see these options on the main page of MPGW.

    Along with these options is there any option like "message type" available on the main page of MPGW?

     

    Thank you,

    Sri. 

     

    Don't think so.