Results 1 to 4 of 4

Thread: ZmZimletBase.PROXY when using AjxRpc

  1. #1
    JAdj is offline New Member
    Join Date
    May 2007
    Posts
    4
    Rep Power
    8

    Default ZmZimletBase.PROXY when using AjxRpc

    Hi everybody.

    I'm new to Zimbra and therefore to Zimlets.

    I'm trying to create a zimlet that makes an http (GET or POST) request to a server in a computer on my local network.

    I've been watching how other Zimlets do this, and I'm trying to use AjxRpc function to do this.

    This function gets, as a parameter, the url to which you want to send your request. Every single zimlet I have seen use the variable ZmZimletBase.PROXY to form this url

    example:
    var url = ZmZimletBase.PROXY + AjxStringUtil.urlEncode(dir);

    My question is: Is there any way of creating an URL without using ZmZimletBase.PROXY? I have tried just removing it but AJxRpc throws an exception.
    If I use the variable, the request is not addressed to the url I want, the resulting url is something like: http://(IP of Zimbra PC)/zimbra?target=(dir), and I dont want to send the request there.

    I've also tried to modify ZmZimletBase.PROXY, same result: Exception was thrown.

    How is the appropriate way to modify this variable?

    Any help would be appreciated. Thanks you very much in advance

  2. #2
    JoshuaPrismon is offline Zimlet Guru & Moderator
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    9

    Default

    Quote Originally Posted by JAdj View Post
    Hi everybody.

    I'm new to Zimbra and therefore to Zimlets.

    I'm trying to create a zimlet that makes an http (GET or POST) request to a server in a computer on my local network.

    I've been watching how other Zimlets do this, and I'm trying to use AjxRpc function to do this.

    This function gets, as a parameter, the url to which you want to send your request. Every single zimlet I have seen use the variable ZmZimletBase.PROXY to form this url

    example:
    var url = ZmZimletBase.PROXY + AjxStringUtil.urlEncode(dir);

    My question is: Is there any way of creating an URL without using ZmZimletBase.PROXY? I have tried just removing it but AJxRpc throws an exception.
    If I use the variable, the request is not addressed to the url I want, the resulting url is something like: http://(IP of Zimbra PC)/zimbra?target=(dir), and I dont want to send the request there.

    I've also tried to modify ZmZimletBase.PROXY, same result: Exception was thrown.

    How is the appropriate way to modify this variable?

    Any help would be appreciated. Thanks you very much in advance
    The fundamental problem is that the web server enforces a same-origin policy on XMlHTTPRequest (the method below AjxRpc). That means that the Zimlet can only talk to the same server that it loaded from in the first place. That means to talk to any other server, you must proxy via the Zimlet proxy code. That Zimlet proxy code approves connections based on the XML configuration file you provided with the Zimlet.

    The URL that is generated is the instructions to the proxy on how to get to the server you actually want.

  3. #3
    JAdj is offline New Member
    Join Date
    May 2007
    Posts
    4
    Rep Power
    8

    Default

    Quote Originally Posted by lostknight View Post
    The fundamental problem is that the web server enforces a same-origin policy on XMlHTTPRequest (the method below AjxRpc). That means that the Zimlet can only talk to the same server that it loaded from in the first place. That means to talk to any other server, you must proxy via the Zimlet proxy code. That Zimlet proxy code approves connections based on the XML configuration file you provided with the Zimlet.

    The URL that is generated is the instructions to the proxy on how to get to the server you actually want.
    Thank you lostknight, I made it work by allowing the domain I wanted to address on Zimbra.

    I have another doubt, however. My zimlet doesnt match the regular expression on the Contact List, it does it only in email bodies. How can I make it work on every frame of the Web Interface?

    what does the parameter "paren" under the tag <regex> means?

    Thank you very much

  4. #4
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    8

    Default Problems with post

    FYI, I don't know if it's fixed now or not. But in the lower 4.0 versions of Zimbra, the proxy using post did not work so well. We had to have javascript open a new window and post to the server we wanted to post to. But I think it's working now, you can check the bugzilla.

    I'm trying to do the same thing you are doing, would you mind posting or sending me the code you are using to connect create your request.
    EricX

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. AjxRpc and Ports?
    By mghaught in forum Zimlets
    Replies: 7
    Last Post: 03-22-2006, 04:18 PM
  2. AjxRpc vs. ZmCsfeAsynchCommand
    By Heladito in forum Developers
    Replies: 1
    Last Post: 10-31-2005, 09:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •