Middleware returned invalid JSON string 1013 Error?

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

I'am Getting Error Like "Middleware returned invalid JSON string"

through hitting service in client(mobile end).

Note :

1. when hit this service in postman it's working

2. when hit it's mobile fabric it's working but through mobile service integration it's not working

Hi,

You have to pass all the required headers and body params as the backend expects.

Also,

when the same is working from postman, can you please check what header is missing via MF server.

Let us know if you still face the issue even after you pass all the required headers.

Also share us the middle ware logs in debug mode to debug the issue.

Thank you

Hi

thank you for your reply . Yes till I'm facing that issue it's coming.

{"httpresponse":{"response":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<title>Kony Server Console - Access Denied</title>\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta name=\"keywords\" content=\"\" />\n<meta name=\"description\" content=\"\" />\n<link href=\"/admin/ui/images/favicon.ico\" rel=\"icon\" />\n<link href=\"/admin/ui/images/favicon.ico\" rel=\"shortcut icon\"\n\ttype=\"image/x-icon\" />\n<link href=\"/admin/ui/css/base.css\" type=\"text/css\"\n\trel=\"stylesheet\" />\n<link href=\"/admin/ui/css/jquery-ui.css\" rel=\"stylesheet\"\n\ttype=\"text/css\" />\n<link href=\"/admin/ui/css/jquery/jquery.ui.base.css\"\n\trel=\"stylesheet\" type=\"text/css\" />\n<link href=\"/admin/ui/css/dashboard.css\"\n\trel=\"stylesheet\">\n\t<link href=\"/admin/ui/css/custom.css\"\n\t\trel=\"stylesheet\">\n\n\t\t<script></script>\n\t\t<script></script>\n\t\t<script></script>\n\t\t<script></script>\n\t\t<script></script>\n\n\t\t<style type=\"text/css\">\n.showPanel {\n\tdisplay: block;\n}\n\n.hidePanel {\n\tdisplay: none;\n}\n\n.icon-restricted-access {\n\tbackground: url(ui/images/no-access.svg) no-repeat;\n}\n\n.icon64 {\n\twidth: 64px;\n\theight: 64px;\n}\n\n.di-block {\n\tdisplay: inline-block !important;\n}\n\n.center-align-content {\n\twidth: 550px;\n\theight: auto;\n\tposition: absolute;\n\tdisplay: table;\n\tleft: 0;\n\tright: 0;\n\ttop: 0;\n\tbottom: 0;\n\tmargin: auto;\n\ttext-align: center;\n\tmax-width: 100%;\n\tmax-height: 100%;\n}\n</style>\n\t\t<script>\nvar browseAppPanelCollapseFlag = false;\nfunction toggleCollapse(obj){\n\tvar panel = document.getElementById(\"BrowseAppPanelColpanel\");\n\tif(browseAppPanelCollapseFlag){\n\t\tpanel.className=\"showPanel\";\n\t\tbrowseAppPanelCollapseFlag = false;\n\t}\n\telse{\n\t\tpanel.className=\"hidePanel\";\n\t\tbrowseAppPanelCollapseFlag = true;\n\t}\n}\n\n</script>\n</head>\n\n<body onload=\"showError()\">\n\t<!--header start-->\n\t<!--header end-->\n\t<nav class=\"navbar navbar-inverse navbar-fixed-top\" role=\"navigation\">\n\t<!-- Brand and toggle get grouped for better mobile display -->\n\t<div class=\"navbar-header\">\n\t\t<div class=\"navbar-brand\">\n\t\t\t<div class=\"brand-img\">\n\t\t\t\t<img src=\"/admin/ui/images/logo.jpg\">\n\t\t\t</div>\n\t\t\t<div class=\"textBrand\">App Services</div>\n\t\t</div>\n\t</div>\n\t</nav>\n\t<!-- body start -->\n\t<div class=\"center-align-content\" id=\"restrict-cases\">\n\t\t<div class=\"restrict-access\" id=\"case-1\">\n\t\t\t<center>\n\t\t\t\t<i class=\"icon64 di-block icon-restricted-access\"></i>\n\t\t\t</center>\n\t\t\t<h4>\n\t\t\t\t<span id=\"errorCapSpan\">Access Restricted</span>\n\t\t\t</h4>\n\t\t\t<p class=\"text-left pb-10 mb-10\">\n\t\t\t\t<span id=\"errorspan\"></span>\n\t\t\t</p>\n\t\t\t</br>\n\t\t</div>\n\t</div>\n\t<!-- body end -->\n\t<!-- script start-->\n\t<script>\n\t\tvar default_error_message = 'You do not have permission to view this page.';\n\t\tfunction showError() {\n\t\t\tvar errMessage = '';\n\t\t\tif (!errMessage) {\n\t\t\t\terrMessage = default_error_message;\n\t\t\t}\n\t\t\tdocument.getElementById('errorspan').innerHTML = errMessage;\n\t\t}\n\t</script>\n\t<!-- script end-->\n\t</div>\n\n\t\n</body>\n</html>\n","headers":{"X-Android-Received-Millis":"1538039769383","Cache-Control":"no-cache, no-store, max-age=0, must-revalidate","Ex

Note :

Here attached middleware log file But could't get Exact error but in Repose is coming like

  1. post man it's working (header is Content-Type -application/json
  2. mobile fabric also working but through code it's getting error