Welcome! Log In Create A New Profile

Advanced

[WM20] - How to post an array to a web service

Posted by YogiYang 
[WM20] - How to post an array to a web service
February 07, 2019 06:10PM
Hello,

I am using following code to send/post content to a web service.
StudentIDs is array of string

HTTPCreateForm("FORM")
HTTPAddParameter("FORM", "tpush_subject", "Test Subject")

ArrayAdd(StudentIDs,1213)
ArrayAdd(StudentIDs,31)

HTTPAddParameter("FORM", "sm_id", StudentIDs) //this line gives error

HTTPAddParameter("FORM", "method", "POST")

bResLancement is boolean = HTTPSendForm("FORM", sURL)

How to send array via HTTPSendForm?

TIA

--
Yogi Yang
pao
Re: [WM20] - How to post an array to a web service
February 08, 2019 06:40PM
The webservice is made by you as well?
If yes, the easiest way is to convert the array to a JSON string using serialize send it as one of the parameters and in the webservice receive the string and use the JSONTOVARIANT function.
Instead of JSON you can use XML or some other format.

Regards

Paulo Oliveira
Re: [WM20] - How to post an array to a web service
February 09, 2019 05:19AM
Hello,

Thanks for the tip. Actually it is a ready to consume web service which is provided by thirdparty.

TIA

--
Yogi Yang
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: