Ezjscore problem

Author Message

Håvard Bergersen

Monday 08 November 2010 4:02:01 am

I have created some ezjscore servercall functions.

When running the call i via the addressbar (http://www.example.com/ezjscore/call/something::somethingelse::parameter) get the expected values.

When running it via a js file, is doesn't work.

function functionName(id,cat){
    jQuery(function( $ )
    {
    // Any action here will work. E.g an alert, or console.log(); or something
        $.ez( 'someThing::someThingElse::'+id+'::'+cat, {arg1: ' '}, function( data )
        {
        // Any action here will NOT work!

So,, all the information extraction is successfully done, and the right function is trigged, but within the $.ez() function nothing happens...

Anybody knows what the problem might be?

Nicolas Pastorino

Monday 08 November 2010 4:14:17 am

Hi Håvard ,

Have you made sure the generated JS actually is correct ? ie : if generated from a template, was it encapsulated in {literal} {/literal} tags ?

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Håvard Bergersen

Monday 08 November 2010 4:19:07 am

The funtion is in it's own .js file, and the calling of the function is done i the template. The calling is correct) :)

Would have gotten javascript errors if it wasn't?

Might be worth mentioning that the servercall returns the right values, when survailing it with firebug:
Response: 200 OK , and all the content i asked for is there...

Nicolas Pastorino

Monday 08 November 2010 4:28:51 am

Even when tracking the server's answer through Firebug, you see the correct content ? Json i suppose ?

If nothing in the callback function is run, it might mean that JS execution is stopping before the calback function is called in $.ez(..). Is the returned content (from the ajax call to the server) likely to contain unproper sequences of character ?

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Håvard Bergersen

Monday 08 November 2010 4:38:06 am

"

Even when tracking the server's answer through Firebug, you see the correct content ? Json i suppose ?

"

Yes (!) That's the weird part hehe..:)

As far as I can tell, there is nothing unproper about the chars.

I suspect there might be a typo somewhere in the 400 line long .js file, that f*** things up? Is that a possibility? Allthoug i thik that would be weird, becase if that is the matter, than nothing should have worked? Or?

Gaetano Giunta

Monday 08 November 2010 6:33:20 am

In case it might help you: the svn version of the ggwebservices extension just had ezjscore support committed to it (lat night!).

You can use the extension to send ezjscore calls to the server itself, and have dumps of request and response printed to screen.

The response is also parsed as json, so if there is some 'bad' character ruining your responses, you should be able to spot it.

(ps: sorry for this self-promotion ;-) )

Principal Consultant International Business
Member of the Community Project Board

Gaetano Giunta

Monday 08 November 2010 6:35:03 am

ps: you can also test using Y.io.ez instad of jquery, to see if the fault lies in the part of the js code that sits between the actual response and your own js response handler...

Principal Consultant International Business
Member of the Community Project Board

Håvard Bergersen

Tuesday 09 November 2010 3:48:06 am

Hehe, thanks for the tip.. Will try it out :)

Håvard Bergersen

Tuesday 09 November 2010 4:30:20 am

It seems the problem is between the .js and the .php files included. Both works fine seperatly, but when combining them they fail...?

Nicolas Pastorino

Tuesday 09 November 2010 5:41:17 am

Could you push this online somewhere, so that we can put hands on. Forum-debugging is not suitable to these "extreme weirdness" cases :)

Cheers !

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Håvard Bergersen

Tuesday 09 November 2010 7:17:39 am

Hmmmm... Maybe i could but,,

There is a jscore function, calling a custom fetch function, that fetches from a restricted windows 2005 server.. (my environment is linux..)

Sooo,, need less to say, it's not easy to recreate this.. :)

I suspect there is a error of some sort in the [...]functioncollection.php, OR is there som kind of problem connected to running ezFunctionHandler::execute on custom fetches via ezjscore? I don't know.. :)

Gaetano Giunta

Tuesday 09 November 2010 8:04:55 am

As far as my experience goes (in coding the ezwebservicesapi extension), there is no problem in running a fetch from within an ezjscore function: http://svn.projects.ez.no/ezwebservicesapi/trunk/extension/ezwebservicesapi/classes/ezwebservicesapiexecutor.php (look at static method ezpublish_fetch

Principal Consultant International Business
Member of the Community Project Board

Nicolas Pastorino

Wednesday 10 November 2010 7:09:54 am

Any move on the topic ?

How about pasting the firebug output (of the XHR) plus de js code used in some snippet sharing place ?

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Gaetano Giunta

Friday 12 November 2010 2:14:15 am

I'd go as far as suggest using Wireshark or the ff plugin livehttpheaders to debug this and get a reliable trace of the requests

Principal Consultant International Business
Member of the Community Project Board

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 01:15:07
Script start
Timing: Jan 18 2025 01:15:07
Module start 'layout'
Timing: Jan 18 2025 01:15:07
Module start 'content'
Timing: Jan 18 2025 01:15:08
Module end 'content'
Timing: Jan 18 2025 01:15:08
Script end

Main resources:

Total runtime1.3919 sec
Peak memory usage4,096.0000 KB
Database Queries92

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 587.7969152.6094
Module start 'layout' 0.00510.0040 740.406339.4219
Module start 'content' 0.00901.3808 779.8281716.9453
Module end 'content' 1.38980.0020 1,496.773432.1875
Script end 1.3918  1,528.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2439160.0002
Check MTime0.00130.0959160.0001
Mysql Total
Database connection0.00060.041910.0006
Mysqli_queries1.284092.2486920.0140
Looping result0.00190.1343900.0000
Template Total1.357197.520.6785
Template load0.00200.141420.0010
Template processing1.355197.355320.6775
Template load and register function0.00010.007710.0001
states
state_id_array0.00150.110610.0015
state_identifier_array0.00100.071620.0005
Override
Cache load0.00170.1206680.0000
Sytem overhead
Fetch class attribute can translate value0.00060.042530.0002
Fetch class attribute name0.00140.0993170.0001
XML
Image XML parsing0.00160.112830.0005
class_abstraction
Instantiating content class attribute0.00010.0061280.0000
General
dbfile0.00110.0755280.0000
String conversion0.00010.004040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
14content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
14content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
17content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 50
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs