Issues with WebClientUtils plugin on the application server.

Hi all,

I’m trying to use the WebClientUtils plugin to call a Servoy function from the web client side. It works fine in developer, but fails every time when deployed to the application server.

Here is the code I am using. As you can see it’s a very simple test. I create one servoy callback, then try to call it from the client side.

Make servoy callback with WebClientUtils:

var callback = plugins.WebClientUtils.generateCallbackScript(globals.client_to_servoy_TEST1, ['str'], true);
var script = 'function client_to_servoy_TEST1(str){' + callback + '}';
var markup = '<script type="text/javascript">' + script + '</script> \n';

Servoy function called is in scope.globals:

/**
 * @param {String} str
 * @public 
 * @properties={typeid:24,uuid:"614190C0-19FF-461A-B6D2-C3139FE6D445"}
 */
function client_to_servoy_TEST1(str) {
	var js = 'servoy_to_client_TEST1("TEST")';
	plugins.WebClientUtils.executeClientSideJS(js);
}

The HTML running on client:

<html><head> <script type="text/javascript">function client_to_servoy_TEST1(str){if (function(){return true;}.bind(this)()) { Wicket.showIncrementally('indicator');}var wcall=wicketAjaxPost('?x=d5IHZJsyQSmAnMIhXEGXgXxi*1VKIXkB','m=22392378'+'&p='+encodeURIComponent(str),function() { ;Wicket.hideIncrementally('indicator');}.bind(this),function() { ;Wicket.hideIncrementally('indicator');}.bind(this), function() {if (!function() {return true;}.bind(this)()) {Wicket.hideIncrementally('indicator');}return true;}.bind(this));}</script> 
<script type="text/javascript"></script> 
<script> 

document.addEventListener("DOMContentLoaded", clientInit, false); 

function clientInit() { console.log("-> clientInit()"); console.log("CALLING: client_to_servoy_TEST1");client_to_servoy_TEST1(JSON.stringify("TEST_STRING")); console.log("<- clientInit()"); }

function servoy_to_client_TEST1(str) { console.log("-> servoy_to_client_TEST1(str)"); console.log("str = " + str); console.log("<- servoy_to_client_TEST1(str)"); console.log("\n*** SUCCESS!!! ***"); } 

</script> 
</head> <body> <H1>Client HTML</H1></body></html>

Console output on client:

Uncaught ReferenceError: jQuery is not defined
xxx.3.2:116 -> clientInit()
xxx.3.2:116 CALLING: client_to_servoy_TEST1
xxx.3.2:116 <- clientInit()
http://176.9.83.122:8080/servoy-webclient/application/s/resources/wicketevent/wicket-event.js?w:lm=1423574356 Failed to load resource: the server responded with a status of 404 (Not Found)

As you can see, when my client side function ‘clientInit()’ calls ‘client_to_servoy_TEST1()’, and I get a wicket related error.

Any idea why this is failing?

PS: I am assured by our system administrator that this is not a firewall problem.

Make sure servoy.webclient.nice.urls is set to false in servoy-admin. The plugin is not compatible with that.

ptalbot:
Make sure servoy.webclient.nice.urls is set to false in servoy-admin. The plugin is not compatible with that.

Thanks ptalbot, everything is now working! :)