Search the web
Sign In
New User? Sign Up
jsolait
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
XMLRPCAsyncCallback   Message List  
Reply | Forward Message #396 of 411 |
RE: [jsolait] Re: XMLRPCAsyncCallback

Hi, jan

 

I’ve been happy playing with jsolait since. J

 

Apparently, there is small bug with opera browser.

 

Any rpc call back  using async call would have failed in opera, where in other browser does fine.

 

If try to trace it, and find it here in urllib.js, in mod.sendRequest, line 245 (original urllib.js)

Xmlhttp apparently always null when called via opera.

 

This cause callback function cannot retreive return value from rpc calls

 

I havent try jsolait v2 because will require complete rewrite of phpolait

 

Best regards

Henry Eko

 

PS: cut down urllib.js

 

mod.sendRequest=function(type, url, user, pass, data, headers, callback){

198 var async=false;

199 //check if the last argument is a function and treat it as callback;

200 if(arguments[arguments.length-1] instanceof Function){

201 var async=true;

202 callback = arguments[arguments.length-1];

203 }

204 //treat sencond last(if callback)/last(if no callback) argument as headers

205 var headindex=arguments.length-((async || arguments[arguments.length-1] == null) ?2:1);

206 //is it an array then it's headers

207 if(arguments[headindex] instanceof Array){

208 headers=arguments[headindex];

209 }else{

210 headers=[];

211 }

212 //are user AND password not specified then assume data as 3rd argument.

213 if(typeof user == "string" && typeof pass == "string"){

214 if(typeof data != "string"){

215 data="";

216 }

217 }else if (typeof user == "string"){

218 data = user;

219 user=null;

220 pass=null;

221 }else{

222 user=null;

223 pass=null;

224 }

225 var xmlhttp= getHTTP();

226 try{

227 if(user!=null){

228 xmlhttp.open(type, url, async, user, pass);

229 }else{

230 xmlhttp.open(type, url, async);

231 }

232 }catch(e){

233 throw new mod.RequestOpenFailed(e);

234 }

235 //set headers

236 for(var i=0;i< headers.length;i++){

237 try{//opera 8b does not support setRequestHeader todo:

238 xmlhttp.setRequestHeader(headers[i][0], headers[i][1]);

239 }catch(e){

240 }

241 }

242

243 if(async){//set up a callback

244 xmlhttp.onreadystatechange=function(){

245 /*FIXME : Opera cannot do callback here. xmlhttp object always null*/

246 //dojo.debug(p);

247 if (xmlhttp!=null)

248 if (xmlhttp.readyState==4) {

249 callback(xmlhttp);

250 xmlhttp = null; //help IE with garbage collection

251 }else if (xmlhttp.readyState==2){

252 //status property should be available (MS IXMLHTTPRequest documentation)

253 //in Mozilla it is not if the request failed(server not reachable)

254 //in IE it is not available at all ?!

255 try{//see if it is mozilla otherwise don't care.

256 var isNetscape = netscape;

257 try{//if status is not available the request failed.

258 var s=xmlhttp.status;

259 }catch(e){//call the callback because Mozilla will not get to readystate 4

260 callback(xmlhttp);

261 xmlhttp = null;

262 }

263 }catch(e){

264

265 }

266 }

267 }

268 }

269

270 try{

271 xmlhttp.send(data);

272 }catch(e){

273 if(async){

274 callback(xmlhttp, e);

275 xmlhttp=null;

276 }else{

277 throw new mod.SendFailed(e);

278 }

279 }

280 return xmlhttp;

281 }

 

 

 


From: jsolait@yahoogroups.com [mailto:jsolait@yahoogroups.com] On Behalf Of Jan-Klaas Kollhof
Sent: Wednesday, August 22, 2007 15:28
To: jsolait@yahoogroups.com
Subject: [jsolait] Re: XMLRPCAsyncCallback

 


> Can I bundle jsolait in distribution with my modified phpolait?

Yes you can.

Jan



Wed Oct 31, 2007 3:16 am

dmaster97
Offline Offline
Send Email Send Email

Forward
Message #396 of 411 |
Expand Messages Author Sort by Date

Can somebody please post an example of how to set up an asynchronous xmlrpc call and callback function? Thanks!...
n1ywb_1
Offline Send Email
Dec 1, 2005
3:16 am

... Here the example: var xmlrpc=imprt('xmlrpc'); var service = new xmlrpc.ServiceProxy('/test.py', ['echo']); service.echo('Hello jsolait', function(result,...
Jan-Klaas Kollhof
keyjaque
Offline Send Email
Dec 2, 2005
3:23 pm

Hello, i'm new to jsolait. i've using it like a charm. but i have problems with callbacks. i use json rpc instead of xml rpc, but i think the case would be the...
dmaster97
Offline Send Email
Jun 23, 2007
5:14 am

I think I need some more info on that, maybe some code so I can reproduce the problem. There is no reason why the callback should not see the function. e.g: ...
Jan-Klaas Kollhof
keyjaque
Offline Send Email
Jun 26, 2007
8:18 pm

Hello, Sorry for the long reply. I finally get it work. Thank you. I'm working on modified phpolait, and I'm a bit clueless to move from jsolait v.1 to jsolait...
Henry Eko Hapsanto
dmaster97
Offline Send Email
Aug 21, 2007
8:24 am

... Yes you can. Jan...
Jan-Klaas Kollhof
keyjaque
Offline Send Email
Aug 22, 2007
8:29 am

Hi, jan I've been happy playing with jsolait since. :-) Apparently, there is small bug with opera browser. Any rpc call back using async call would have...
Henry Eko Hapsanto
dmaster97
Offline Send Email
Oct 31, 2007
3:05 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help