Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to post to another server
#6
This method has been working for well for me.

In my case I need client of IW app 1 to retrieve information from IW app 2.  This method may work where app 2 is a non IW server as long as the POST is formatted correctly but I haven't tried it.


Method A:  Retrieve info from IW app 2 that only needs to be displayed in an IW control of client of IW app 1.


Code:
1.  Create a custom content handler like '/customapp2content' in IW app 2 to respond
    to requests from client of IW app 1.
2.  Send async request to IW app 2 like so:
    WebApplication->CallBackResponse->AddJavaScriptToExecuteAsCDATA("$.post(\"https://www.app2.com/customapp2content\", \"REQUST MESSAGE\", function(data,  status) { $('#MEMO').val(data); } );");

    IW control 'MEMO' will now display IW app 2 response. "REQUST MESSAGE" is your optional message you may want to send to IW app 2.

Method B:  Retrieve info from IW app 2 that needs to update an IW control of client of IW app 1.

Code:
1.  Create a custom content handler like '/customapp2content' in IW app 2 to respond
    to requests from client of IW app 1.
2.  Create an ajax callback in IW app 1 to process response from IW app e.g.

    ExtraHeader->Add("<script language=\"javascript\" type=\"text/javascript\">function CB(d) { ajaxCall(\"CB\",\"&1=\"+encodeURIComponent(d), true); }</script>");
    RegisterCallBack("CB",CB);
    void __fastcall TTestForm::CB(TStringList *EventParams) { MEMO->Text = EventParams->Values["1"]; }

3.  Send async request to IW app 2 like so:
    WebApplication->CallBackResponse->AddJavaScriptToExecuteAsCDATA("$.post(\"https://www.app2.com/customapp2content\", \"REQUST MESSAGE\", function(data, status) { CB(d); } );");
    IW control 'MEMO' will now update IW app 1 with IW app 2 response. "REQUST MESSAGE" is your optional message you may want to send to IW app 2.
Reply


Messages In This Thread
how to post to another server - by amit.walters - 04-27-2019, 06:29 PM
RE: how to post to another server - by MJS@mjs.us - 11-04-2020, 04:39 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)