Issues with WebClientUtils plugin on the application server.

Questions and answers on developing, deploying and using plugins and JavaBeans

Issues with WebClientUtils plugin on the application server.

Postby david.e » Thu Jul 30, 2015 2:19 pm

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:
Code: Select all
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:
Code: Select all
/**
* @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:
Code: Select all
<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:
Code: Select all
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.
david.e
 
Posts: 2
Joined: Thu Jul 30, 2015 1:28 pm

Re: Issues with WebClientUtils plugin on the application ser

Postby ptalbot » Fri Jul 31, 2015 12:11 am

Make sure servoy.webclient.nice.urls is set to false in servoy-admin. The plugin is not compatible with that.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Issues with WebClientUtils plugin on the application ser

Postby david.e » Fri Jul 31, 2015 12:13 pm

ptalbot wrote: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! :)
david.e
 
Posts: 2
Joined: Thu Jul 30, 2015 1:28 pm


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 49 guests