Donald Charity
Posts: 0
Joined: Thu Feb 06, 2014 2:58 pm

No response body in response (JSON)

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?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

No response body in response (JSON)

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

Donald Charity
Posts: 0
Joined: Thu Feb 06, 2014 2:58 pm

No response body in response (JSON)

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"
}

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

No response body in response (JSON)

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.

Donald Charity
Posts: 0
Joined: Thu Feb 06, 2014 2:58 pm

No response body in response (JSON)

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.

Donald Charity
Posts: 0
Joined: Thu Feb 06, 2014 2:58 pm

No response body in response (JSON)

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.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

No response body in response (JSON)

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

Donald Charity
Posts: 0
Joined: Thu Feb 06, 2014 2:58 pm

No response body in response (JSON)

I get a syntax error here:

Image

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

Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

No response body in response (JSON)

Hi Donald,

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

Donald Charity
Posts: 0
Joined: Thu Feb 06, 2014 2:58 pm

No response body in response (JSON)

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!

Return to “Issues”