Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SOAP, RESTful, Avalara

Status
Not open for further replies.

RFanslow

Programmer
Jul 16, 2014
24
0
0
US
Good Morning All

I have a fairly large project coming up soon working in Foxpro 7 and have the need to communicate with a third-party software via either Soap or RESTful API. while its been some time since i have had to do either, i am speculating using a http request obj and soap, although on my intial tests i am having difficuty making a connection which i am assuming is based on the authheaders as i am requested to use Basic Authentication.

Anyway, has anyone worked with a company called Avalara, (sales/use taxation). I need to develop something to communicate with them about 1000 times a day all data is stored in legacy 2.5 tables along with all of the existing legacy code VFP 7.0 (which is converted from FP 2.5)

Any idea's, comments...
looking for a solution in VFP ,

Open to suggestions and comments

Thanks

Fanz
 
First, if this is a new project, not just additions to your existing project, do yourself a favor and work in VFP 9 SP2 with all the hotfixes. That way, you'll get the absolute latest possible version, with lots of bug fixes.

Toni Feltman did a session about REST at last year's Southwest Fox conference. I don't see her paper online, but you can try contacting her (through the F1 technologies website) to see if it's available.

Tamar
 
If there is no special reason (eg Soap being the more complete API) I'd always opt for RESTful APIs. While a standard protocol like SOAP is has the advantage of being a basis for many things, MS extended support for the soap toolkit is not automatically extending support of that SOAP version in the industry overall and using soap APIs typically ends in needing to write your own low level routines creating and parsing XML soap messages.

REST APIs can be very specific to each single API, but typically have a very small footprint in message structures. most often several response formats are available, including JSON and XML without all the soap overhead.

You may use Winsock, Wininet API or use the XMLHttpRequest (eg MSXML2.XmlHttp.6.0) offering all you need:
1. Open: Prepare a request with POST, GET and other http verbs, synchronous or asynchronous.
2. SetRequestHeader: set headers like BasicAuthentication, some others are set automatically, eg you don't need to compute the request size and set Content-Length.
3. Send: Send the request including the body, if any (eg a typical GET request has no body, a POST request has the POST data).
4. readystate: observe states of the request until it arrives back at readystate=4.
5. status: http status, eg 200 for OK or the most famous 404 - file not found.
6. GetResponseHeader/GetAllResponseHeaders: get headers, if needed.
7. ResponseBody/Stream/Text/XML: Several properties for the response in several formats for several purposes.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top