Hi,

I'm following the learning article at http://theformspider.com/learningcenter/how-to-use-external-method/, and everything works fine except the cookie is not read when getUserCoolie method is invoked in the PostOpen event.

I added a logging call in the getUserCookie procedure to display the cookie:

api_debug.log('cookie retrieved: '||api_externalMethod.getresult('getUserCookie')||' result: '||api_externalMethod.issuccessful('getUserCookie'));

And here is the result: USER : 05-05-2016 13:42:18 cookie retrieved: result:

However, if I create a button on the LoginPanel, and make the same procedure called from the button pressed event, it works.

Also tried putting it onto panel's postInitialize event - didn't work.

Is there any other way to make it retrieve the cookie automatically during the app loading process?

Thanks!

asked 05 May '16, 17:25

Ilia%20Sazonov's gravatar image

Ilia Sazonov
120512
accept rate: 0%


Hi Ilia,

You can read cookies in the postMethodInvoke event of externalMethod but not before.

Appliction's postOpen and Panel's postInitialize are fired before external methods are executed. That's why you cannot read cookies.

Kind Regards Serdar

link

answered 10 May '16, 08:11

Serdar's gravatar image

Serdar ♦♦
100k4
accept rate: 13%

Thanks, Serdar. The learning tutorial and the demo application posted here link text specifically states -

-- triggered from **Application event "Post Open"**
procedure getUserCookie is
  v_params_t api_externalMethod.tt_params;
begin
  -- cookie name
  v_params_t('0').value_tx := 'externalMethodDemo';
  -- invoke "getUserCookie" external method
  api_externalMethod.invoke('getUserCookie', v_params_t);
end;

We have to invoke the external method getCookie during the page load process, otherwise the cookie is useless. And then we call

-- triggered from External Method event "Post method completed" of the "getUserCookie" external method
procedure checkUserByCookie is

This works in the Demo app, but I can't make it work in my app. It seems that as though the external method is invoked, the post external method procedure is not, and the cookie is not read.

Here is my setup:

procedure getUserCookie is
  v_params_t api_externalMethod.tt_params;
  begin
    api_debug.log('entering getUserCookie');
    -- cookie name
    v_params_t('0').value_tx := 'cfgLegacyAuth';
    -- invoke "getUserCookie" external method
    api_externalMethod.invoke('getUserCookie', v_params_t);
    api_debug.log('cookie retrieved: '||api_externalMethod.getresult('getUserCookie')||

' result: '||api_externalMethod.issuccessful('getUserCookie')); api_debug.log('exiting getUserCookie'); exception when others then api_debug.log('error: '||sqlerrm);raise; end getUserCookie;

procedure checkUserByCookie is
  v_result_tx          varchar2(8000);
  v_userName_tx        varchar2(4000);
  v_password_tx        varchar2(4000);
  v_seperatorIndex_nr  number;
  begin
    api_debug.log('entering checkUserByCookie');

So, when I execute this procedure in the Application Post Open action, here is the output in my debug window:

USER : 08-05-2016 18:45:24 entering getUserCookie
USER : 08-05-2016 18:45:24 cookie retrieved:  result:
USER : 08-05-2016 18:45:24 exiting getUserCookie

Yet if I execute the same procedure from a button on the same panel, I can see my cookie being read:

USER : 08-05-2016 18:46:20 entering getUserCookie
USER : 08-05-2016 18:46:20 cookie retrieved: ilia;password result: Y
USER : 08-05-2016 18:46:20 exiting getUserCookie

And my second procedure is still not being executed.

Is there anything else that needs to be done apart from what is indicated in the learning material? Can you please share the entire demo app XML?

Thanks!

link

answered 10 May '16, 20:22

Ilia%20Sazonov's gravatar image

Ilia Sazonov
120512
accept rate: 0%

Hi Ilia,

Have you set the "post method completed" action in the external method edit dialog?

Kind Regards Serdar

(11 May '16, 07:47) Serdar ♦♦

Yes, Serdar, I have. Please see the screenshot.

Thanks! alt text

link

answered 11 May '16, 14:39

Ilia%20Sazonov's gravatar image

Ilia Sazonov
120512
accept rate: 0%

Hi Ilia,

There might be a bug here. Once we reproduce it locally. I'll let you know the results.

Kind Regards
Serdar

link

answered 12 May '16, 04:42

Serdar's gravatar image

Serdar ♦♦
100k4
accept rate: 13%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×4
×3
×2

Asked: 05 May '16, 17:25

Seen: 2,917 times

Last updated: 12 May '16, 04:42


© Copyright Gerger 2017