Post and Get with Wam

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
hoangtrungcs
Posts: 14
Joined: Wed Sep 21, 2016 12:54 pm

Post and Get with Wam

Post by hoangtrungcs » Tue Jul 31, 2018 11:40 am

Hello everybody!

How can post url and pass parameter to other website in Wam ?

Thank you so much!

AbelS
Posts: 29
Joined: Wed Nov 16, 2016 1:43 pm
Location: Sydney, Australia
Contact:

Re: Post and Get with Wam

Post by AbelS » Tue Jul 31, 2018 1:51 pm

For POST, you need to do nothing special. The form that you post must have the fields you want to pass to your target webroutine (where they should be mapped for input)

For passing fields in the url, see: https://docs.lansa.com/14/en/lansa087/i ... s%7C_____3

PS: Fields must also be mapped for input in your target webroutine.

HTH

hoangtrungcs
Posts: 14
Joined: Wed Sep 21, 2016 12:54 pm

Re: Post and Get with Wam

Post by hoangtrungcs » Wed Aug 01, 2018 12:38 pm

Hi AbelS

Thank you so much! I will follow your link.

hoangtrungcs
Posts: 14
Joined: Wed Sep 21, 2016 12:54 pm

Re: Post and Get with Wam

Post by hoangtrungcs » Thu Aug 02, 2018 5:53 pm

Can I transfer to a outside link from Wam, not local link ?

Example:
I have form with HTML with some input of parameters, and one button Submit.
After I fill value for input = 123, I click submit button then in wam I set value to a default link as same https://abc.com/data?param=123
So how can I redirect to that link from wam or other solution is Ok?

Thank you so much !

AbelS
Posts: 29
Joined: Wed Nov 16, 2016 1:43 pm
Location: Sydney, Australia
Contact:

Re: Post and Get with Wam

Post by AbelS » Fri Aug 03, 2018 9:36 am

You have to build the link yourself and use Javascript. For example see https://stackoverflow.com/questions/902 ... javascript

hoangtrungcs
Posts: 14
Joined: Wed Sep 21, 2016 12:54 pm

Re: Post and Get with Wam

Post by hoangtrungcs » Mon Aug 06, 2018 3:34 pm

Hi AbelS

Thank you for your support.

After build Javascript to redirect to another page(not LANSA page), then after processed that page will return value to LANSA.
The return url as same : https://ip/CGI-BIN/lansaweb?wam=ZTEST&w ... t=10000000

In LANSA I can not get value of additionData, and amount from link above, because in LANSA in order to get parameter from this url must have f()
==> https://ip/CGI-BIN/lansaweb?wam=ZTEST&w ... )=10000000

So do you have any solution to get value of parameter from above link without f() ?

Thank you so much !

AbelS
Posts: 29
Joined: Wed Nov 16, 2016 1:43 pm
Location: Sydney, Australia
Contact:

Re: Post and Get with Wam

Post by AbelS » Tue Aug 07, 2018 8:44 am

If you don't want the fields in the url, create a form, add the fields you want to send to this form and post it.

HTH

AbelS
Posts: 29
Joined: Wed Nov 16, 2016 1:43 pm
Location: Sydney, Australia
Contact:

Re: Post and Get with Wam

Post by AbelS » Tue Aug 07, 2018 9:16 am

I just noticed your field name is "additionData". You need to use the field id (short name) not the long name (See what the short name is in your LANSA repository)

hoangtrungcs
Posts: 14
Joined: Wed Sep 21, 2016 12:54 pm

Re: Post and Get with Wam

Post by hoangtrungcs » Tue Aug 07, 2018 1:32 pm

hi AbelS

Thank you so much for your support
I just create test flow in attached file.
In attached at process ③ I will receive the return parameter from target website, but in this url return don't include f() for LANSA get paramter.
So I think I should get value of these parameter from Javascript or you can get value from response target url in Wam ?
Attachments
request_response.JPG
request_response.JPG (41.82 KiB) Viewed 2791 times

AbelS
Posts: 29
Joined: Wed Nov 16, 2016 1:43 pm
Location: Sydney, Australia
Contact:

Re: Post and Get with Wam

Post by AbelS » Wed Aug 08, 2018 7:55 am

  • To pass a field value in the url you have to use the f() notation. If you don't have control on the format of the url from the target website, you will need to write a script that receives the request, translates it to the format required by a WAM and redirects the request
  • Ensure that you are using the field identifier and not the long name (your last example shows the long name)

hoangtrungcs
Posts: 14
Joined: Wed Sep 21, 2016 12:54 pm

Re: Post and Get with Wam

Post by hoangtrungcs » Thu Aug 09, 2018 11:33 am

Hi Abels

Thank you so much for your support!

Post Reply