api - wso2 Could not save JSON payload. Invalid input stream found -


  1. this first rest api in wso2, sequence in wso2 below.

<? xml version = "1.0" encoding = "utf-8" ?>  < api xmlns = "http://ws.apache.org/ns/synapse"      name = "createissue"      context = "/rest"      hostname = "xxx"      port = "xxx" >        < resource methods = "post"      insequence = "createinsequence"      `enter code here`      outsequence = "createoutsequence" >        < faultsequence / >        < /resource>  </api >              <? xml version = "1.0"      encoding = "utf-8" ?>        < sequence xmlns = "http://ws.apache.org/ns/synapse"      name = "createinsequence" >            < log level = "custom" >            < property name = "location"            expression = "json-eval($.fields)" / >        < /log>        </sequence >

  1. the curl command making invoke api, below.

    'curl -x post -h "content-type:application/json" -d@"h:\createissue_own.json" "http://ip:port/rest/api/createissue"'

  2. wso2 esb console shows following error

    newjsonpayload. not save json payload. invalid input stream found.'

  3. the input json, valid json, have validated , given below.

{    "fields": {      "project": {        "id": "10301"      },      "summary": "issue",      "description": "description text",      "issuetype": {        "id": "10205"      },      "customfield_10600": {        "id": "10300"      },      "customfield_10602": {        "id": "10301"      },      "customfield_10603": "id text",      "customfield_10608": {        "id": "10303"      },      "customfield_10609": " text",      "customfield_10610": " text",      "customfield_10611": " text",      "customfield_10612": "postcode text"    }  }

any suggestions please. not able hit url, , log input json.

this error comes when send xml payload application/json content-type header esb. best thing can here enable wirelogs , check http headers , payloads sent esb. enable wirelogs follow these steps,

  • shutdown esb instance
  • move onto $esb_home/repository/conf directory , locate log4j.properties file uncomment following line

    log4j.logger.org.apache.synapse.transport.http.wire=debug

  • then restart esb instance again , send request

monitor esb console wirelogs follows

the symbol '>>' gives contents written esb , '<<' gives contents written out of esb.

also doubt curl command, hence sample curl command given below.

   curl -v -d @test.json -h "content-type:application/json" http://localhost:8280/rest/api/createissue 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -