kalmen chia
Posts: 0
Joined: Tue Dec 25, 2012 2:25 am

How to use mimic xmlrpc to make a call to other apps and get response ?

Hi ,

I am trying to explore appery.io and i drop a button on my form and
i have already imported the mimic.js ,

now at my button's event , i selected "Run java script" and put my code
below :

Code: Select all

var method = "login" ; 
var request = new XmlRpcRequest("[url=http://myappserver.com/xmlrpc/common]http://myappserver.com/xmlrpc/common[/url]", method); 

request.addParam('dbname1');
request.addParam('user');
request.addParam('passwd');

var response = request.send();
return response.parseXML();

i get no response back, the same code works at google app script , so
i tried to select another event "Invoke service" and got stuck at the
UI , becuase there is no documents refer to this topic ,

can anyone please help ?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How to use mimic xmlrpc to make a call to other apps and get response ?

Hi!

Do you have any errors in console?

kalmen chia
Posts: 0
Joined: Tue Dec 25, 2012 2:25 am

How to use mimic xmlrpc to make a call to other apps and get response ?

Hi ,

So sorry , i am not a javascript guy , perhaps you have to direct me to do that ?
you mean using firebug from my chrome ?
or inspect using chrome ? Do let me know how to capture the error . many thanks.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How to use mimic xmlrpc to make a call to other apps and get response ?

Yes, you can do it with Firebug.

kalmen chia
Posts: 0
Joined: Tue Dec 25, 2012 2:25 am

How to use mimic xmlrpc to make a call to other apps and get response ?

Hi ,

Watched console , no error message , and i put some code in my function like below ...
code
XmlRpcRequest.prototype.send = function() {
var xml_params = "&quot
for(var i = 0; i < this&#46;params&#46;length; i++)
xml_params += XmlRpc&#46;PARAM&#46;replace("${DATA}", this&#46;marshal(this&#46;params));
var xml_call = XmlRpc&#46;REQUEST&#46;replace("${METHOD}", this&#46;methodName);
xml_call = XmlRpc&#46;PROLOG + xml_call&#46;replace("${DATA}", xml_params);
alert(xml_call);
var xhr = Builder&#46;buildXHR();
alert(xhr);
alert(this&#46;serviceUrl);
xhr&#46;open("POST", this&#46;serviceUrl, false);
xhr&#46;send(Builder&#46;buildDOM(xml_call));
return new XmlRpcResponse(xhr&#46;responseXML);
/code

alert()...

I realized that it will stop functioning at xhr.open , is appery.io block any
non approved API Restful call or cross domain call ?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to use mimic xmlrpc to make a call to other apps and get response ?

Hello! No, Appery.io doesn't block anything. Cross domain call can be blocked by browser if you test in browser, but in this case you should get corresponding error in console.
Delete alerts from XmlRpcRequest.prototype.send and add alert on button click before return response.parseXML();
Should be codealert(response); alert(response&#46;parseXML());/code
This way you can see is there any responce returns.
Also could you clarify what are you going to do with responce you get?

kalmen chia
Posts: 0
Joined: Tue Dec 25, 2012 2:25 am

How to use mimic xmlrpc to make a call to other apps and get response ?

Hi ,

Tested as per your advice , in my button click , added the alert , but nothing happened. no error message. but the button click did call the function
send. as my previous alert showed it.

And this is a test of xml-rpc called to my erp backend server , i need to
build a mobile client for it. (now is testing and see whether the appery.io
can do it , tested almost most in the market for cloud JavaScript mobile designer
none can be found useful so far for me , all is either too simple and are not real
development like appery.io ) .by the way my code is for login to a db,

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to use mimic xmlrpc to make a call to other apps and get response ?

Could you please check your URL here http://www.hurl.it/ (paste your URL, click Send). Do you get any results?

kalmen chia
Posts: 0
Joined: Tue Dec 25, 2012 2:25 am

How to use mimic xmlrpc to make a call to other apps and get response ?

Hi,

I have tried , i think i got some result from the hurl but i do not know how
to use it .,.. especially how to use hurl to replace the
follow code

code
var method = "login" ;&#47;&#47;document&#46;getElementById("operation")&#46;value;
var request = new XmlRpcRequest("http:&#47;&#47;myserver:8099&#47;xmlrpc&#47;common1", method);
&#47;&#47;request&#46;setAuthentication("admin", "admin");
&#47;&#47;request&#46;addParam(document&#46;getElementById("n1")&#46;value);
&#47;&#47;request&#46;addParam(document&#46;getElementById("n2")&#46;value);
request&#46;addParam('db_2013');
request&#46;addParam('admin');
request&#46;addParam('admin');
/code

I got some error like

HTTP/1.0 500 INTERNAL SERVER ERROR
Content-Type: text/html
Content-Length: 291
Server: Werkzeug/0.8.3 Python/2.6.6
Date: Sun, 26 May 2013 15:46:28 GMT

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"
500 Internal Server Error

i think the error is because i do not pass the params to the url.
but i am quite sure that in my google app scripts that the xmlrpc call is
successful/

And i do not know how to use hurl.it to pass the params to xmlrpc servers.
Any comments ?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to use mimic xmlrpc to make a call to other apps and get response ?

Using hurl.it or any thing outside of Appery.io is outside the scope of our support.

Return to “Issues”