Page 1 of 2

No response body in response (JSON)

Posted: Fri Feb 07, 2014 2:11 am
by Donald Charity

I get a [HTTP/1.1 200 OK 1573ms] on a service call invoked in javascript

restservice2.execute({
xhrFields: {

Code: Select all

     withCredentials: true 

  } 

});

, but the response body where the JSON should be is not showing. Is there something missing with my service call to get the JSON data to show?


No response body in response (JSON)

Posted: Fri Feb 07, 2014 2:16 am
by Igor

When you test the service in Test tab - were you getting results from the service?


No response body in response (JSON)

Posted: Fri Feb 07, 2014 2:29 am
by Donald Charity

No it would always be an error because of the withCredentials is always false by default with Appery.io so I have to execute the service with the

restservice2.execute({
xhrFields: {

withCredentials: true

}

});

call through JS.

This is the response using the TEST tab.

{
"status":"401 Unauthorized",
"url":"https://itteinnoprod.sj.us.ericsson.n...",
"response":"\n401: Access Denied\n"
}


No response body in response (JSON)

Posted: Fri Feb 07, 2014 3:05 am
by Igor

Are you using credentials in your service settings request parameters? Please read itteinnoprod.sj.us.ericsson.net service API docs and make shure that you use correct authorization parameters for your service.


No response body in response (JSON)

Posted: Fri Feb 07, 2014 3:11 am
by Donald Charity

yes I cam using my correct credentials in the service settings request parameters. This is my second call to the service. My first call was to log in to get session cookie to authenticate me on any subsequent call which im trying to do now with:

restservice2.execute({
xhrFields: {

withCredentials: true

}

});

im getting a 200 ok but no response body.


No response body in response (JSON)

Posted: Fri Feb 07, 2014 3:17 am
by Donald Charity

interesting if i have the service perform open link (the url from the resetservice2) in new window "on Complete" I can see the json there.


No response body in response (JSON)

Posted: Fri Feb 07, 2014 3:21 am
by Igor

Could you attach screenshots from browser network tab with service request and response?


No response body in response (JSON)

Posted: Fri Feb 07, 2014 1:31 pm
by Donald Charity

I get a syntax error here:

Image

I do get the JSON however in the response, weird?

Image


No response body in response (JSON)

Posted: Fri Feb 07, 2014 3:06 pm
by Kateryna Grynko

Hi Donald,

Click the error itself please. You should see where exactly ";" is not found. Unfortunately we can't see it in this screenshot.


No response body in response (JSON)

Posted: Fri Feb 07, 2014 4:50 pm
by Donald Charity

Ok figured it out, in my php I needed to handle both jsonp and json for different occasions, in my Appery.io app I was using jsonp which adds a callback to the url string. So on my response echo from my php file I needed that callback.

$json = json_encode($data2);
echo "{$_GET['callback']}($json)";

I am able to parse json now in my app.

Thanks!