Using tsNetPost

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
JackieBlue1970
Posts: 64
Joined: Thu Jan 16, 2020 10:28 pm
Location: Max Meadows, VA USA

Using tsNetPost

Post by JackieBlue1970 » Fri Jul 24, 2020 11:20 pm

Good afternoon and happy Friday.

I'm doing some testing with LC and the eBay XML API. Basically involves a POST to eBay's server. I'm testing with a simple request - GetOfficialEbayTime (yes it says get but all the eBay requests are POST). I've tested my XML in eBay's API Explorer which allows me to paste my XML code. This was successful. However, using the same headers (and variations to test) and XML it fails using LC's lesson code sample format:

Code: Select all

put "X-EBAY-API-COMPATIBILITY-LEVEL:  '1149'" into xCompatLevel  
   put "X-EBAY-API-DEV-NAME: " & devID into xDevID
   put "X-EBAY-API-APP-NAME: " & appID into xAppID
   put "X-EBAY-API-CERT-NAME: "& certID into xCertID
   put "X-EBAY-API-CALL-NAME: GeteBayOfficialTime"  into xAPICALL  //only interested in message request at this point
   put "X-EBAY-API-SITEID:  0" into xSiteID  //defaulted to USA
   put "content-type: text/xml" into xContent //default text/xml content
   
   /*create request*/
   put xCompatLevel & " " & xDevID & " " & xAppID & " " & xCertID & " " & xAPICALL & " " & xSiteID & " " & xContent & " Request Payload:  " into Header
   
   /*build request*/
   put "<?xml version='1.0' encoding='utf-8'?>" into xStep1
   put xStep1 & "<GeteBayOfficialTimeRequest xmlns='urn:ebay:apis:eBLBaseComponents'>" into xStep2
   put xStep2 & "<RequesterCredentials><eBayAuthToken>xyz....zyx</eBayAuthToken></RequesterCredentials>" into xStep2a
   put xStep2a & "<ErrorLanguage>en_US</ErrorLanguage>" into xStep3
   put xStep3 & "<WarningLevel>High</WarningLevel>" into xStep4
   put xStep4 & "</GeteBayOfficialTimeRequest>" into xPayload



put tsNetPost("connectionA",serverURL,xHeader,xPayload,"postResponse") into tError  
I keep getting errors similar to this:

Image




Any ideas? I suspect it is something to do with how the requests are formatted since I know the XML is correct. TIA.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5861
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Using tsNetPost

Post by jacque » Sat Jul 25, 2020 6:58 pm

No idea really, but have you tried the more generic POST command instead of TSNetPost?

Edit: This looks like a good candidate for the merge function when creating the xml.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

JackieBlue1970
Posts: 64
Joined: Thu Jan 16, 2020 10:28 pm
Location: Max Meadows, VA USA

Re: Using tsNetPost

Post by JackieBlue1970 » Sun Jul 26, 2020 2:16 am

Thank you. Can’t hurt. I’ll give it try on Monday. I thought I saw something in the forums that the POST command was not preferred though.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5861
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Using tsNetPost

Post by jacque » Sun Jul 26, 2020 6:24 am

JackieBlue1970 wrote:
Sun Jul 26, 2020 2:16 am
Thank you. Can’t hurt. I’ll give it try on Monday. I thought I saw something in the forums that the POST command was not preferred though.
It's all I've ever used, and I've never had any issues with it. I'm not sure why it wouldn't be preferred, I don't remember seeing that anywhere.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Internet”