Basic question... http object request failed, unable to process hyperEvent

1,007 views
Skip to first unread message

Anne

unread,
Apr 18, 2008, 6:05:32 AM4/18/08
to InterSystems: Zen Community
Hi,

I get this message - even everything seems to go ok.

This is in case where I invoke ZenMethod from onloadHandler.

I'd like to invoke it from %OnAfterCreatePage, but I can't because
there is also some javascripts (&js<....>) in code.

I invoke this same ZenMethod from 4 different methods on page, from
javascript method and from ZenMethod and that's ok there.

The method initializes parameters and valuelists for some components
depending on changes in different some components. And this is the
same method I'd like to use when I load the old details on page.

But what is there I should know, so I wouldn't get this error? I know,
I could try to code it two different ways: 1. like this to be
ZenMethod with &js<> and onether method to be just javascript or just
objectScript, but this is not what I want if not compulsory.
-A-

Bill McCormick

unread,
Apr 18, 2008, 11:53:57 AM4/18/08
to InterSys...@googlegroups.com
Without sample code its impossible to tell you.

Hyperevents are implemented via the XMLHTTP interface provided by
modern browsers. Essentially we pass some arguments and a url to the
XMLHTTP class and it builds a SOAP request that calls the web server.
This error is a message from the XMLHTTP interface that a soap fault
or http error was reported coming back from the web server.

This can be a network fault, a packet issue, a malformed SOAP payload,
a web server hiccup or a fault triggered by bad code in the method
being called on the server


Generally speaking I can't see why you would be calling back to the
server in an OnLoad Handler. There is nothing about what is going on
the page that has changed from the time you created it on the server.
IJust because there is js in the method does not mean anything. You
can code generate a method into the page DOM or have that JS be part
of a method defined in the page that the onload handler calls anyway.
I am not saying that is the root cause simply that I find doing a call
back to the server at that point redundant.

You could insert an HTML component into the %OnAfterCreatePage that
simply dumped out the JS into the page if that was required as an
option.


Bill McCormick
Product Manager
Development Technologies
+1 617 621 0600
bill.mc...@intersystems.com

Joe DeSantis

unread,
Apr 18, 2008, 2:22:43 PM4/18/08
to InterSys...@googlegroups.com
At 03:05 AM 4/18/2008 -0700, you wrote:

Hi,

I get this message - even everything seems to go ok.

This is in case where I invoke ZenMethod from onloadHandler.

It is not a good idea to call server methods from the onloadHandler. You can't be too sure of the state of the browser when it calls onload.



I'd like to invoke it from %OnAfterCreatePage, but I can't because
there is also some javascripts (&js<....>) in code.

There is a way that you can tell if your method is being called during first page display or as a result of a server method call: There is a global variable called %zenContext that is set to tell you *why* your Zen methods are being called.

If (%zenContext =
"page" )   /// then this is the first time your page is called
If (%zenContext =
"method" )   /// then you are being called from the client as a server method

This might let you keep the &js<> code from bothering your OnAfterCreatePage....

HTH

joed

Anne

unread,
Apr 18, 2008, 3:26:41 PM4/18/08
to InterSystems: Zen Community
Hi,

thanks, this was sufficient for me about basics :)

I divided the method to two methods: zenMethod and javascript method.
Another is called from %OnAfterCreatePage and another from
onloadHandler.

"You can't be too sure of the state of the browser when it calls
onload. "
I think this was true, because the error didn't come every time. It
also depended about minor changes in code.

-A-

On 18 huhti, 21:22, Joe DeSantis <joe.desan...@intersystems.com>
wrote:
Reply all
Reply to author
Forward
0 new messages