First let me say thank you for your response to my question. I will reply to each section.
On Fri, Oct 23, 2009 at 7:39 PM, Gene Amtower <g...@pc-backup.com> wrote: > Don, > > First, I think there's a misunderstanding about what crossDomain means - it > does not refer to a "domain" in the sense of a domain name or network > domain. It is just used here to refer to a request to a different RPC URL > than the source page that makes the RPC request. Since you mentioned that > the client is in the same network domain as the server, it appears you may > have misinterpreted this terminology. I actually understood this point. My intention in stating the FQDN of my systems was that whether or not crossDomain was enabled, the requests made from the server should have worked. > Also, when you don't set crossDomain explicitly, it defaults to FALSE in the > implementation of qx.io.remote.RPC. So, I would expect your requests with > it set to FALSE to have the same result as your requests where you didn't > set it at all. In fact, they are the same between these two scenarios in > all except 4 of your tests in sections 2 & 5 - where your request came from > //server and your rpc call went to //server. Since you didn't show any code > from your app or remote service, it's not clear why these scenarios would be > different - Setting crossDomain to FALSE and not setting it at all should > have yielded the same result between #1, 2, 5, & 6. Maybe you made a > mistake somewhere in your testing, and these scenarios really would have had > the same result if done as you stated. [ -------------------------------------------- | Begin QooxDoo Code | -------------------------------------------- ] // Create a button var button1 = new qx.ui.form.Button("Submit"); // create a text field to hold the e-mail address var emailField = new qx.ui.form.TextField(); emailField.setWidth(140); var emailLabel = new qx.ui.basic.Label("e-mail address:"); // setup rpc class var rpc = new qx.io.remote.Rpc(); rpc.setTimeout(10000); rpc.setUrl("http://server.domain.com/app/controller/call/jsonrpc"); rpc.setServiceName(""); // asynchronous call var handler = function(result, exc, id) { if (exc == null) { alert("Result of async call: " + result); } else { alert("Exception during async call: " + exc); } }; // Document is the application root var doc = this.getRoot(); // Add button to document at fixed coordinates doc.add(button1, {left: 100, top: 50}); // Add email field to document root doc.add(emailLabel, {left: 100, top: 0}); doc.add(emailField,{left: 175, top: 0}); // Add an event listener button1.addListener("execute", function(e) { // asynchronous call rpc.callAsync(handler, "search", emailField.getValue()); //rpc.callAsync(handler, "echo", "Test"); [ -------------------------------------------- | End QooxDoo Code | -------------------------------------------- ] [ -------------------------------------------- | Begin Web2py Code | -------------------------------------------- ] import ldap server='ldap.domain.com' base_dn='ou=ldap,o=domain.com' search='mail' def index(): redirect(URL(r=request,f='searchApp')) def searchApp(): return dict() def call(): # remove session.forget() if you want to use session cookies for services session.forget() return service() @service.jsonrpc def search(email="d...@domain.com"): dn = None search = 'email' filter = '('+search+'='+email+')' attrs = ['uid'] con = ldap.initialize("ldaps://" + server + ":" + "636") result=con.search_s(base_dn, ldap.SCOPE_SUBTREE, filter) dn=result[0][0] return dn @service.jsonrpc def echo(msg): return msg [ -------------------------------------------- | End Web2py Code | -------------------------------------------- ] This app creates two callable service functions: echo(), and search(). Echo simply returns what was sent to it. Search searches the ldap server and returns the distinguished name (dn). I have tested this from the python shell using jsonrpclib on both the server itself and on other machines. It worked. [ -------------------------------------------- | Begin Python Shell | -------------------------------------------- ] Python 2.4.3 (#1, Jul 27 2009, 17:56:30) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import jsonrpclib >>> rpc = >>> jsonrpclib.ServerProxy("http://server.com/app/controller/call/jsonrpc", >>> verbose=1) >>> print rpc.echo("Hello World!!") connect: (server, 80) send: 'POST /app/controller/call/jsonrpc HTTP/1.0\r\nHost: server\r\nUser-Agent: jsonlib.py/0.0.1 (by matt harrison)\r\nContent-Type: text/xml\r\nContent-Length: 56\r\n\r\n' send: '{"params": ["Hello World!!"], "method": "echo", "id": 3}' reply: 'HTTP/1.1 200 OK\r\n' header: Date: Sat, 24 Oct 2009 03:02:22 GMT header: Server: Apache/2.2.3 (Red Hat) header: Expires: Sat, 24 Oct 2009 03:02:22 GMT header: Pragma: no-cache header: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 header: Set-Cookie: session_id_app=IP-89-8be806cc-e740-4f31-85da-500e9b45e7a1; Path=/ header: Connection: close header: Content-Type: text/html; charset=UTF-8 body: '{"error": null, "version": "1.1", "id": 3, "result": "Hello World!!"}' {u'result': u'Hello World!!', u'version': u'1.1', u'id': 3, u'error': None} >>> >>> >>> >>> >>> print rpc.search("d...@domain.com") connect: (server.domain.com, 80) send: 'POST /app/controller/call/jsonrpc HTTP/1.0\r\nHost: server.domain.com\r\nUser-Agent: jsonlib.py/0.0.1 (by matt harrison)\r\nContent-Type: text/xml\r\nContent-Length: 63\r\n\r\n' send: '{"params": ["d...@domain.com"], "method": "search", "id": 5}' reply: 'HTTP/1.1 200 OK\r\n' header: Date: Sat, 24 Oct 2009 03:06:00 GMT header: Server: Apache/2.2.3 (Red Hat) header: Expires: Sat, 24 Oct 2009 03:06:00 GMT header: Pragma: no-cache header: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 header: Set-Cookie: session_id_app=IP-89c94dbe-9609-4c0e-96c5-fb47f5f450a2; Path=/ header: Connection: close header: Content-Type: text/html; charset=UTF-8 body: '{"error": null, "version": "1.1", "id": 5, "result": "uid=X-XXXXXXX,c=uk,ou=ldap,o=domain.com"}' {u'result': u'uid=X-XXXXXXX,c=uk,ou=ldap,o=domain.com', u'version': u'1.1', u'id': 5, u'error': None} >>> [ -------------------------------------------- | End Python Shell | -------------------------------------------- ] > In summary, when you access a page at one URL and request an RPC service at > a different URL, you are going to need to set crossDomain to true. This is > likely why eight of your requests came back as "Unknown Status code", since > these were all cases where the page URL did NOT match the RPC URL and you > essentially had crossDomain set to FALSE (half by setting it to FALSE and > half by leaving it at the default of FALSE). > > Secondly, you didn't mention how your RPC server is configured. In the case > of RPC-PHP, the RPC server is configured by default to only allow > non-cross-domain requests. If you haven't checked this setting, then this > would explain why your requests with crossDomain set to TRUE would fail. > The server is likely ignoring the crossDomain request because it's set to > not allow them. Also note that setting crossDomain to TRUE will force a > different request mode, as pointed out in the API docs for qx.io.remote.RPC, > specifically using scriptTransport mode. So, even if you have set the RPC > server to allow crossDomain requests, it is possible that the specific > request you are implementing cannot be done via RPC with crossDomain set to > TRUE - it really depends on what you are trying to send and receive in your > specific implementation. I sent a message to the web2py mailing list today asking is there was anything needed to allow for cross domain calls in it json-rpc setup. The answer was no. The python shell tests confirmed in my mind that the web2py backend was working properly. http://groups.google.com/group/web2py/browse_thread/thread/1b224f2206b816b5# > > Anyway, I hope some of what I've said here provides some additional insight > for you. Derrell, please correct anything I might have stated incorrectly > here, as you're the expert in this area. > > Regards, > > Gene > > On Fri, 2009-10-23 at 15:28 -0400, Don Lee wrote: > > I am using qooxdoo-0.8.3, along with web2py as my backend. My web > server and client are on the same network/domain. I have observer that > depending on the URL provided to the RPC object and whether I set > crossDomain, I get weird behavior even when running the software from > the web server itself. I have found the following: > > web server / json-rpc service host = server.domain.com / server > client resolves to client.domain.com (they are both in the same domain) > > 1. > ------- > setting > var rpc = new > qx.io.remote.Rpc("http://server.domain.com/app/controller/call/jsonrpc"); > rpc.setCrossDomain(false); > > - connecting to http://server/qxapp/source from the client produces > "Transport error 0: Unknown status code" > - connecting to http://server/qxapp/source from the server produces > "Transport error 0: Unknown status code" > - connecting to http://server.domain.com/qxapp/source from the client > produces a positive response from the service > - connecting to http://server.domain.com/qxapp/source from the server > produces a positive response from the service > > > 2. > ------- > setting > var rpc = new qx.io.remote.Rpc("http://server/app/controller/call/jsonrpc"); > rpc.setCrossDomain(false); > > - connecting to http://server/qxapp/source from the client produces > "Local error 1: Local time-out expired" > - connecting to http://server/qxapp/source from the server produces > "Local error 1: Local time-out expired" > - connecting to http://server.domain.com/qxapp/source from the client > produces "Transport error 0: Unknown status code" > - connecting to http://server.domain.com/qxapp/source from the server > produces "Transport error 0: Unknown status code" > > > 3. > ------- > setting > var rpc = new > qx.io.remote.Rpc("http://server.domain.com/app/controller/call/jsonrpc"); > rpc.setCrossDomain(true); > > - connecting to http://server/qxapp/source from the client produces > "Local error 1: Local time-out expired" > - connecting to http://server/qxapp/source from the server produces > "Local error 1: Local time-out expired" > - connecting to http://server.domain.com/qxapp/source from the client > produces "Local error 1: Local time-out expired" > - connecting to http://server.domain.com/qxapp/source from the server > produces "Local error 1: Local time-out expired" > > > > 4. > ------- > setting > var rpc = new qx.io.remote.Rpc("http://server/app/controller/call/jsonrpc"); > rpc.setCrossDomain(true); > > - connecting to http://server/qxapp/source from the client produces > "Local error 1: Local time-out expired" > - connecting to http://server/qxapp/source from the server produces > "Local error 1: Local time-out expired" > - connecting to http://server.domain.com/qxapp/source from the client > produces "Local error 1: Local time-out expired" > - connecting to http://server.domain.com/qxapp/source from the server > produces "Local error 1: Local time-out expired" > > > 5. > ------- > setting > var rpc = new qx.io.remote.Rpc("http://server/app/controller/call/jsonrpc"); > ** do not call rpc.setCrossDomain() > > - connecting to http://server/qxapp/source from the client produces a > positive response from the service > - connecting to http://server/qxapp/source from the server produces a > positive response from the service > - connecting to http://server.domain.com/qxapp/source from the client > produces "Transport error 0: Unknown status code" > - connecting to http://server.domain.com/qxapp/source from the server > produces "Transport error 0: Unknown status code" > > > 6. > ------- > setting > var rpc = new > qx.io.remote.Rpc("http://server.domain.com/app/controller/call/jsonrpc"); > ** do not call rpc.setCrossDomain() > > - connecting to http://server/qxapp/source from the client produces > "Transport error 0: Unknown status code" > - connecting to http://server/qxapp/source from the server produces > "Transport error 0: Unknown status code" > - connecting to http://server.domain.com/qxapp/source from the client > produces a positive response from the service > - connecting to http://server.domain.com/qxapp/source from the server > produces a positive response from the service > > > I would think that at the very least, running the code from the server > would always produce positive results. That does not appear to be the > case, at least in my setup. Can anyone shed some light? > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > qooxdoo-devel mailing list > qooxdoo-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > qooxdoo-devel mailing list > qooxdoo-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel