Topic
  • 10 replies
  • Latest Post - ‏2013-11-18T20:34:03Z by Ray-MN
koganti
koganti
30 Posts

Pinned topic empty input document cannot be schema validated

‏2013-08-19T06:46:33Z |

Hi Can you please me in getting a solution on this

empty input document cannot be schema validated

Regards

saradhi

Updated on 2013-08-19T06:47:10Z at 2013-08-19T06:47:10Z by koganti
  • swlinn
    swlinn
    1348 Posts

    Re: empty input document cannot be schema validated

    ‏2013-08-19T13:12:07Z  

    Hi Saradhi,

    Do you mean for your processing rule to be able to handle both empty docs, most probably a HTTP GET, and a document put with a HTTP POST?  You could specify a separate rule for HTTP GETs by having a match rule for the HTTP Method GET which would not do the validate.  You could also in the same processing rule have a stylesheet that checked the service variable var://service/protocol-method or perhaps var://service/request-size and output that in a simple node set that would be input to a conditional action that would only do the validate for an HTTP POST or a request size != 0.  But regardless, the first question is still most important.  Why are you getting empty docs and should you be getting them in the first place?

    Regards,

    Steve

  • JoeMorganNTST
    JoeMorganNTST
    427 Posts

    Re: empty input document cannot be schema validated

    ‏2013-08-21T15:52:20Z  

    You could also have NULL as input to an action on your processing rule.  You may need to check the rule(s) to ensure you have valid inputs for all actions.

    In it is legitimately possible to have a NULL input for a policy, maybe we need my RFE:

    http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=36253

    Go vote for it if this applies.

     

  • HermannSW
    HermannSW
    4885 Posts

    Re: empty input document cannot be schema validated

    ‏2013-08-21T17:07:02Z  

    Hi,

    Schema validation purpose is to validate XML documents.

    An empty document is not an XML document, so Schema validation has to fail.
    (This is "a" minimal XML document: <x/>)

    Hermann.

  • HermannSW
    HermannSW
    4885 Posts

    Re: empty input document cannot be schema validated

    ‏2013-09-01T19:46:03Z  
    • HermannSW
    • ‏2013-08-21T17:07:02Z

    Hi,

    Schema validation purpose is to validate XML documents.

    An empty document is not an XML document, so Schema validation has to fail.
    (This is "a" minimal XML document: <x/>)

    Hermann.

    I forgot to mention that you can do JSON Schema Validation starting with v6.0 firmware:
    JSON schema validation example

    But an empty document is not "JSON-text" as by the spec "JSON-text = object / array" and therefore a first character '[' or '{' must exist.


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

     

  • priysund
    priysund
    2 Posts

    Re: empty input document cannot be schema validated

    ‏2013-09-02T09:08:43Z  

    I suspect that you would have tried to do some operation in an action and save the result in a context variable(OUTPUT or some other custom context). However, in your case, this variable may be empty because your action did not execute correctly. You would be later using this OUTPUT in the consequent action or as an INPUT in the response rule.

    I am facing a similar issue in my rule and I discovered that the variable is empty. You need to check what you are doing in the action.

  • Ray-MN
    Ray-MN
    3 Posts

    Re: empty input document cannot be schema validated

    ‏2013-11-18T16:13:53Z  
    • HermannSW
    • ‏2013-09-01T19:46:03Z

    I forgot to mention that you can do JSON Schema Validation starting with v6.0 firmware:
    JSON schema validation example

    But an empty document is not "JSON-text" as by the spec "JSON-text = object / array" and therefore a first character '[' or '{' must exist.


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

     

    Hi Herman,

    I'm trying to get a single MPGW that has a rule, based on the URL, that will test each of the functionalities available with JSONiq. As of now I have the Extract, Transform, and Filter examples working. I have not gotten to debugging the Query sample yet but it did not work on the first attempt. I am trying to get the Validate working using the example schema supplied and for some reason it looks to me like it's not loading the schema file properly. I keep seeing this error in the MPGW log.

    mpgw (JSONiq.MPGW): request JSONiq.MPGW.Policy_Validate #1 validate: 'INPUT json-schema local:///JSONiq_Validation_Schema.jsv' failed: Internal Error

    I have tested the Schema and the inbound message using a web based validator and it reports that it's good, should validate.

    Would be happy to send you artifacts if you need/want them.

    -- Ray

  • HermannSW
    HermannSW
    4885 Posts

    Re: empty input document cannot be schema validated

    ‏2013-11-18T17:16:18Z  
    • Ray-MN
    • ‏2013-11-18T16:13:53Z

    Hi Herman,

    I'm trying to get a single MPGW that has a rule, based on the URL, that will test each of the functionalities available with JSONiq. As of now I have the Extract, Transform, and Filter examples working. I have not gotten to debugging the Query sample yet but it did not work on the first attempt. I am trying to get the Validate working using the example schema supplied and for some reason it looks to me like it's not loading the schema file properly. I keep seeing this error in the MPGW log.

    mpgw (JSONiq.MPGW): request JSONiq.MPGW.Policy_Validate #1 validate: 'INPUT json-schema local:///JSONiq_Validation_Schema.jsv' failed: Internal Error

    I have tested the Schema and the inbound message using a web based validator and it reports that it's good, should validate.

    Would be happy to send you artifacts if you need/want them.

    -- Ray

    Can you please attach  JSONiq_Validation_Schema.jsv?

    > I am trying to get the Validate working using the example schema supplied
    >
    From the InfoCenter?


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

  • Ray-MN
    Ray-MN
    3 Posts

    Re: empty input document cannot be schema validated

    ‏2013-11-18T17:24:52Z  
    • HermannSW
    • ‏2013-11-18T17:16:18Z

    Can you please attach  JSONiq_Validation_Schema.jsv?

    > I am trying to get the Validate working using the example schema supplied
    >
    From the InfoCenter?


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

    Hi Herman,

     

    Attached is the validation file and here is the message I am sending through.

    {
        "name"   : "John Smith",
        "sku"    : "20223",
        "price"  : 23.95,
        "shipTo" : {
              "name" : "Jane Smith",
              "address" : "123 Maple Street",
              "city" : "Pretendville",
              "state" : "NY",
              "zip" : "12345"
           },
              "billTo" : {
              "name" : "John Smith",
              "address" : "123 Maple Street",
              "city" : "Pretendville",
              "state" : "NY",
              "zip" : "12345"
           }
    }

    I used http://jsonschemalint.com/ to validate the schema and that the message is valid.

    Let me know if there is anything else.

    Attachments

  • HermannSW
    HermannSW
    4885 Posts

    Re: empty input document cannot be schema validated

    ‏2013-11-18T18:27:33Z  
    • Ray-MN
    • ‏2013-11-18T17:24:52Z

    Hi Herman,

     

    Attached is the validation file and here is the message I am sending through.

    {
        "name"   : "John Smith",
        "sku"    : "20223",
        "price"  : 23.95,
        "shipTo" : {
              "name" : "Jane Smith",
              "address" : "123 Maple Street",
              "city" : "Pretendville",
              "state" : "NY",
              "zip" : "12345"
           },
              "billTo" : {
              "name" : "John Smith",
              "address" : "123 Maple Street",
              "city" : "Pretendville",
              "state" : "NY",
              "zip" : "12345"
           }
    }

    I used http://jsonschemalint.com/ to validate the schema and that the message is valid.

    Let me know if there is anything else.

    Hi Ray,

    I did take a known to be good .jsv from our testbase and got same error as you on 6.0.0.2.

    Then I did change Non-XML request type for the service to JSON and now validation works fine.

    Request type needs to be JSON for JSON Schema validation to work.


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

  • Ray-MN
    Ray-MN
    3 Posts

    Re: empty input document cannot be schema validated

    ‏2013-11-18T20:34:03Z  
    • HermannSW
    • ‏2013-11-18T18:27:33Z

    Hi Ray,

    I did take a known to be good .jsv from our testbase and got same error as you on 6.0.0.2.

    Then I did change Non-XML request type for the service to JSON and now validation works fine.

    Request type needs to be JSON for JSON Schema validation to work.


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

    Thanks Herman, That did it!