Question
Thing Service returns "500 Unexpected Error - Contact your system administrator for more"
Hi,
we would like to call a Service, which returns a JSON, when you call it with a POST request.
Unfortunately, we get the following response when we call the Service via Postman:
The URI we use: http://localhost:8080/Thingworx/Things/{ThingName}/Services/Get_All_Sensor_Data
The Response:
<!DOCTYPE html>
<html>
<head>
<title>Unexpected Error</title>
<script>
function clickAndDisable(link) {
link.onclick = function(event) {
event.preventDefault();
}
}
</script>
</head>
<body>
<div class="widget-panel widget-container widget-content" style="overflow: auto;">
<div class="widget-content widget-image undefined" id="error_Image-1">
<img src="/Thingworx/images/ThingworxLogo.png" alt="Errors"/>
</div>
</div>
<div id="error_Panel-1">
<p>500 Unexpected Error - Contact your system administrator for more details</p>
<a href="/Thingworx" onclick='clickAndDisable(this);'>Back to Composer</a>
</div>
</body>
</html>
Our current code: (not final)
var result = {};
if(code >= 500)
{
try
{
result.message = Resources["JSONErrorResource"].GetBadRequest(
{content: {"plop": "error"}});
result.status = "200";
}
catch( err )
{
logger.error( "The following error occured. " + err );
result.status = "500";
result.message = "Some Error message here";
}
}
else
{
result.status = "200";
result.message = "ok";
}
Our current code: (not final)
var result = {};
if(code >= 500)
{
try
{
result.message = Resources["JSONErrorResource"].GetBadRequest(
{content: {"plop": "error"}});
result.status = "200";
}
catch( err )
{
logger.error( "The following error occured. " + err );
result.status = "500";
result.message = "Some Error message here";
}
}
else
{
result.status = "200";
result.message = "ok";
}

