Hi,
I'm back fro some days out of office.. You're right the code with
result.setJsonPrefix("");
result.setJsonSuffix("");
works with CDN solution. Not needed for non-CDN solution.
Could you provide a link with more information about JSON Suffix and Prefix boundaries and how to applied it?
Thanks.
Announcement
Collapse
No announcement yet.
X
-
We have tried to reproduce the issue to no avail: when we test in our local environment it is working for us.
We have tested both with the js files being loaded from the local war and with the js files deployed to a different server simulating a CDN server. There was no cross server scripting problems, the test data without prefix and suffix was always correctly loaded once we added the lines: result.setJsonPrefix("");
result.setJsonSuffix("");
In any case, we have noticed that there is a typo in the code that you provided. The initial html provided for CDN test (RestDataSourceWithJsonCDN.html) contains two errors in two of the lines, where instead of "https" we can see an extra tralining "h" => "hhttps":
<script src="hhttps://externalhost/smartgwt6p/sc/modules/ISC_Foundation.js"> </script>
<script src="hhttps://externalhost/smartgwt6p/sc/modules/ISC_Containers.js"> </script>
Could it be the cause of the latest problem reported?
Happy new year,
Isomorphic
Leave a comment:
-
Hi,
Thanks for your quick response.
I have added to RestDataSource this two lines without success (creating RestDataSource returns result).. In documentation it states to leave empty to switch off: "You can switch off JSON wrapping altogether by setting both this and jsonSuffix to empty strings."
result.setJsonPrefix("");
result.setJsonSuffix("");
In our implementation we used external CDN, smartclient libraries ("sc" directory) are in other server.
I attached you a code based in your sample RestDataSource JSON (https://isomorphic.atlassian.net/wik...?pageId=524942), where it works with smartclient libraries in same server /RestDataSourceWithJson.html, but it not works with smartclient libreries in external server, (/RestDataSourceWithJsonCDN.html), which is the case, problem we have in our project.
What is the solution? Discard external CDN?
We have compiles attached code with Smart GWT 6p 2016-12-25.
RestDataSourceWithJsonCDN.html (not allowed to upload):
[HTML]<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Web Application Starter Project</title>
<script> var isomorphicDir = "https://externalhost/smartgwt6p/sc/"; </script>
<script src="https://externalhost/smartgwt6p/sc/modules/ISC_Core.js"> </script>
<script src="hhttps://externalhost/smartgwt6p/sc/modules/ISC_Foundation.js"> </script>
<script src="hhttps://externalhost/smartgwt6p/sc/modules/ISC_Containers.js"> </script>
<script src="https://externalhost/smartgwt6p/sc/modules/ISC_Grids.js"> </script>
<script src="https://externalhost/smartgwt6p/sc/modules/ISC_Forms.js"> </script>
<script src="https://externalhost/smartgwt6p/sc/modules/ISC_DataBinding.js"> </script>
<!-- <script src="https://externalhost/smartgwt6p/sc/modules/ISC_Calendar.js"> </script> -->
<script src="https://externalhost/smartgwt6p/sc/skins/Enterprise/load_skin.js"> </script>
<script type="text/javascript" language="javascript" src="restdatasourcewithjsonCDN/restdatasourcewithjsonCDN.nocache.js"></script>
</head>
<body>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position: absolute; width: 0; height: 0; border: 0"></iframe>
<noscript>
<div
style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled in order for this
application to display correctly.</div>
</noscript>
</body>
</html>[/HTML]
RestDataSourceWithJson.html
[HTML]<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Web Application Starter Project</title>
<script> var isomorphicDir = "restdatasourcewithjson/sc/"; </script>
<script src="restdatasourcewithjson/sc/modules/ISC_Core.js"> </script>
<script src="restdatasourcewithjson/sc/modules/ISC_Foundation.js"> </script>
<script src="restdatasourcewithjson/sc/modules/ISC_Containers.js"> </script>
<script src="restdatasourcewithjson/sc/modules/ISC_Grids.js"> </script>
<script src="restdatasourcewithjson/sc/modules/ISC_Forms.js"> </script>
<script src="restdatasourcewithjson/sc/modules/ISC_RichTextEditor.js"></script>
<script src="restdatasourcewithjson/sc/modules/ISC_Calendar.js"> </script>
<script src="restdatasourcewithjson/sc/modules/ISC_DataBinding.js"> </script>
<script src="restdatasourcewithjson/sc/skins/Enterprise/load_skin.js"></script>
<script type="text/javascript" language="javascript" src="restdatasourcewithjson/restdatasourcewithjson.nocache.js"></script>
</head>
<body>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position: absolute; width: 0; height: 0; border: 0"></iframe>
<noscript>
<div
style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled in order for this
application to display correctly.</div>
</noscript>
</body>
</html>[/HTML]
Thanks.
Leave a comment:
-
If this is a RestDataSource, your response lacks the jsonPrefix and Suffix - see docs for these properties, which also explains why you really really want them.
We will, however, clarify this error message.
Leave a comment:
-
The server failed to return a formatted response at all.
We have upgraded SmartGWT 6.0 from build 2016-05-07 to SmartGWT build 2016-12-25.
We use Chrome 53.
We use Grid with JsonRest Data Source, and upngradign build we get the following error: to user in an alert JS: The server failed to return a formatted response at all.
Complete JS error from console:
15:05:09.010:XRP5:WARN:RPCManager:The server failed to return a formatted response at all. - response: {status: -16,
data: "The server failed to return a formatted ..."[56],
httpResponseCode: 200,
httpResponseText: "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n{"response":{"endRow"..."[534],
transactionNum: 2,
clientContext: Obj,
internalClientContext: Obj,
httpHeaders: Obj,
context: Obj,
queueStatus: -1,
startRow: 0,
endRow: 0,
totalRows: 0}
isc.B.push.isc.A.addToMasterLog @ ISC_Core.js:1134
isc_c_Log_addLogMessage @ ISC_Core.js:1133
isc_c_Log_log @ ISC_Core.js:1126
logMessage @ ISC_Core.js:1115
isc.RPCManager.logMessage @ ISC_DataBinding.js:1788
logWarn @ ISC_Core.js:1115
isc_c_RPCManager_runDefaultErrorHandling @ ISC_DataBinding.js:1725
isc_c_RPCManager_handleError @ ISC_DataBinding.js:1711
isc_c_RPCManager__handleError @ ISC_DataBinding.js:1710
isc.B.push.isc.A.fetchRemoteDataReply @ ISC_DataBinding.js:1897
isc_c_Class_fireCallback @ ISC_Core.js:284
isc_Class_fireCallback @ ISC_Core.js:352
isc_DataSource_fireResponseCallbacks @ ISC_DataBinding.js:740
isc_DataSource__completeResponseProcessing @ ISC_DataBinding.js:738
isc_DataSource__handleJSONReply @ ISC_DataBinding.js:622
isc.B.push.isc.A.$379 @ ISC_DataBinding.js:625
isc_c_Class_fireCallback @ ISC_Core.js:284
isc_Class_fireCallback @ ISC_Core.js:352
isc_c_RPCManager_fireReplyCallback @ ISC_DataBinding.js:1701
$wnd.isc.RPCManager.fireReplyCallback @ SmartGwtEntryPoint.java:424
isc_c_RPCManager_fireReplyCallbacks @ ISC_DataBinding.js:1706
isc_c_RPCManager_performOperationReply @ ISC_DataBinding.js:1699
isc_c_RPCManager__performTransactionReply @ ISC_DataBinding.js:1684
isc_c_RPCManager_performTransactionReply @ ISC_DataBinding.js:1607
(anonymous) @ VM5780:3
isc_c_Class_fireCallback @ ISC_Core.js:284
isc_c_Comm_performXmlTransactionReply @ ISC_Core.js:1385
(anonymous) @ VM5779:3
isc_c_Class_fireCallback @ ISC_Core.js:284
isc_c_Comm__fireXMLCallback @ ISC_Core.js:1365
_15 @ ISC_Core.js:1373
Grids with other Datasources are working without problems.
A JSON example:
{"response":{"endRow":1,"totalRows":1,"status":0,"startRow":0,"data":[{"nombrePadre":"","tipoExpediente":"","etqId":"","idCliente":"5981343255101440","prioridad":"Media","nombreExpediente":"Prueba","padre":"0","nombreCliente":"Aragorn hijo de Arathorn","id":6544293208522752,"estado":"abierto","situacion":"","etqnombre":"","auto":"","fechaAlta":"2016-12-22","nombreResponsable":"Jose Nubbius","numExpedienteCompleto":"2016 / 00001","fechaModificacion":"2016-12-23","posicion":"Demandado","tipoProcedimiento":""}]}}
What can be the cause for this? What change in build could make this error appear?
Tags: None
Leave a comment: