Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to consume rest service?
Message
 
À
18/11/2019 11:15:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01671919
Message ID:
01672017
Vues:
56
Yes that totally works but you'll have to manage the HTTP connection and data serialization on your own. Not difficult but reliable HTTP processing takes a bit of effort to get right with XMLHTTP.

Is this a REST service that works with XML? Usually REST services these days work with JSON data and if so you'll also need to deal with JSON encoding/decoding.


FWIW, for those that use West Wind tools there are a number of high level tools built into it for working with REST services specifically as well as all the lower level tools (wwHttp, wwJsonSerializer).

There's a high level `wwJsonServiceClient` class that allows for very easy service access that handles the HTTP and encoding/decoding plus error handling all through a single interface.

wwJsonServiceClient



+++ Rick ---



>Hello all,
>
>I did some searches. and I found some code
>
>Example of making REST GET method call
>
>xmlHttp = CREATEOBJECT("MSXML2.ServerXMLHTTP")
>xmlHttp.open("GET", "put url with parameters here", null)
>xmlHttp.setRequestHeader("Content-Type", "text/xml")
>xmlHttp.send("")
>result = xmlHttp.responseText
>? result
>
>
>Example of making REST POST method call
>
>xmlHttp = CREATEOBJECT("MSXML2.ServerXMLHTTP")
>
>xmlHttp.open("POST", "put URL here", null)
>xmlHttp.setRequestHeader("Content-Type", "text/xml")
>xmlHttp.send("put string to send in body")
>result = xmlHttp.responseText
>? result
>
>
>Should I do my tests with those lines of code or is there something else? a better way to do it?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform