Your assumption about the URL is correct.


I would suggest using post arguments since they will be easily available in the 
server taf as @ARGs



The trick then, is your array, you'll need to stringify it.



I usually do something like this:



<@VAR orderSummary aprefix='' asuffix='' rprefix='' rsuffix='' cprefix='' 
csuffix='' csep=',' rsep=';'>



Because that value will drop into <@ARRAY value=<@ARG …>> however, that assumes 
there can never be any commas or semicolons in the data.



Another idea, since you are only posting 1 order, you could transpose that row. 
In the Webcall Action Post tab, the top option is for an array. That array must 
be 2 columns where the first column are argument names and the second column 
are the values. You can have as many rows as you want. Try this:



<@ASSIGN postArgs <@ARRAY 
value="OrderDetail,@@OrderDetail;SaleCredit,@@SaleCredit;Activity,@@Activity;SalesReceipt,@@SalesReceipt;ToDoItem,@@ToDoItem">>

<@FOR stop=<@NUMCOLS array=request$OrderSummary>>

                <@ADDROWS postArgs <@ARRAY 
value="@@request$OrderSummary[0,<@CURROW>],@@request$OrderSummary[@@OrderRow,<@CURROW>]">>

</@FOR>



(same caveat with the commas and semicolons)



Once you have that postArgs array, you can pass it to the Webcall Argument 
Array and TS will take care of the rest. Each row of that array will be an 
argument available on the server, eg <@ARG OrderDetail>



Robert



PS. The format you suggest below would be a single block of text delimited by 
CRLFs. This is doable, but not as highly structured as other options, including 
what I'm suggesting here.



From: Fogelson, Steve [mailto:foge...@askics.net]
Sent: Thursday, July 11, 2019 1:15 PM
To: TeraScript-Talk@terascript.com
Subject: RE: TeraScript-Talk: Web Service



Thanks Robert,



I have started the project and have a quick question



For each order I need to transmit, I have five tables involved.



In the web call, I thought I would use the Data field on the Post Data tab. 
Would the correct format to be used in that field be the following?

<@var request$OrderSummary[<@var request$OrderRow>,*]>

<@var request$OrderDetail>

<@var request$SaleCredit>

<@var request$Activity>

<@var request$SalesReceipt>

<@var request$ToDoItem>



Also, I assume the url would be to the taf on the server end to import the data?



Thanks



Steve



From: Robert Shubert <rshub...@tronics.com <mailto:rshub...@tronics.com> >
Sent: Thursday, July 11, 2019 1:14 PM
To: TeraScript-Talk@terascript.com <mailto:TeraScript-Talk@terascript.com>
Subject: RE: TeraScript-Talk: Web Service



I think you're going about it the right way.



A web service is nothing more than a regular TAF, but one that a computer is 
going to send a request to, rather than a browser.



I wouldn't use the "web service" technology which is soap based, think along 
the lines of other http APIs you've used that use post arguments or name value 
pairs.



The easiest way to do this is to break the import taf you already have into two 
parts. The first, running on the laptop, prepares the data for the database, 
but instead of an INSERT action, it makes a WEBCALL, with the data packaged in 
some serialized format.



The second half, residing on the server, receives that formatted data, parses 
it and makes the INSERT into the database. Usually you'll want to return a 
fail/success flag so you can debug problems.



I've seen implementations where the actual SQL Insert query is the serialized 
format. Sort of a SQL RPC.



Of course you want to be mindful of security. SSL, password, IP restriction, or 
best, VPN, should be used.



Robert



From: Fogelson, Steve [mailto:foge...@askics.net]
Sent: Thursday, July 11, 2019 8:05 AM
To: TeraScript-Talk@terascript.com <mailto:TeraScript-Talk@terascript.com>
Subject: TeraScript-Talk: Web Service



Good morning. I have an eCommerce app that is also used as a POS at retail 
shows. Sometimes the shows are outdoors with limited bandwidth, so I adapted 
the app to run on it’s own LAN. After the show is over and the laptops are back 
at the main location, I update the live database with the show database using 
an import taf I wrote.



One show in particular has 40,000 people in attendance. Their mobile phones 
suck up the available bandwidth during the day, but there is plenty of 
bandwidth available in the evening to use a hotspot to access the internet.



I would like to write a taf running on a cron job on the local LAN that will 
update the live database over the hotspot. Not sure if I should write a web 
service utilizing TeraScript (it is in the documentation) on the live database 
location to receive the db update requests.



I have used TeraScript’s Web Call action to access many web services, but have 
never written a web service. Does anyone have any experience or examples of a 
web service written in TeraScript or another way of accomplishing what I am 
trying to do?



Thanks



Steve Fogelson

Internet Commerce Solutions







  _____

To unsubscribe from this list, please send an email to lists...@terascript.com 
<mailto:lists...@terascript.com>  with "unsubscribe terascript-talk" in the 
body.



  _____

To unsubscribe from this list, please send an email to lists...@terascript.com 
<mailto:lists...@terascript.com>  with "unsubscribe terascript-talk" in the 
body.



  _____

To unsubscribe from this list, please send an email to lists...@terascript.com 
<mailto:lists...@terascript.com>  with "unsubscribe terascript-talk" in the 
body.




----------------------------------------

To unsubscribe from this list, please send an email to lists...@terascript.com 
with "unsubscribe terascript-talk" in the body.

Reply via email to