ajax to webservice json passing

greeshma

Member
Hi All,
we are in between a new development where front end will a web browser.
server is openedge 10.2B.
from the browser value is passing to webservice as json.
From ajax they are posting to url of webservice which ends in program name wsdxi.p,
which is progress oe 10.2B.
inside that program i have written

Code:
{src/web/method/cgidefs.i}
 
if not WEB-CONTEXT:IS-JSON
then do:
 
  output-content-type ("application/json").
  {&OUT} "Input does not appear to be JSON.<br>"
          "Try setting Content-Type to application/json".
  return.
end.


It always returns the error content is not json.
Ajax team told that they are posting json with media type application/json to this url.
Then what may be the problem where should i look.
This is first time i am working with json. Please help me
 

greeshma

Member
It was a sheer cross domain issue .
When we send the request with method type POST, it will be sending as OPTIONS due to cross domain policy. So in order to resolve this issue, following response headers should be added in the server side.


Access-Control-Allow-Origin: *

Access-Control-Allow-Methods: GET, POST, OPTIONS

Access-Control-Allow-Headers: Content-Type
 
Top