-
Notifications
You must be signed in to change notification settings - Fork 1
Web Services functions
Returns data from a Web Service or RESTful API, as string.
httpGet("http://sampleservice.com/jep/v1/wheather")
Note: This is similar to invoking
httpResponse(http("GET", "http://sampleservice.com/data/v1/wheather"))
Returns data from a Web Service or RESTful API, as string, with custom HTTP headers in the request.
httpGet("http://sampleservice.com/jep/v1/wheather", httpHeader("Accept=text/xml"))
Note: Refer to the
httpHeaders
function for additional details.
Invokes the requested method towards a Web Service or RESTful API, with a given request body, and returns a WebServiceResponse
.
http("POST", "http://sampleservice.com/jep/v1/customer", requestBody)
Note: A
WebServiceResponse
is an object that contains the HTTP status code and the response body/payload. These values can be retrieved by the functionshttpStatusCode()
andhttpResponse()
, respectively.
Invokes the requested method towards a Web Service or RESTful API, with a given request body and a custom HTTP headers, and returns a WebServiceResponse
.
http("POST", "http://sampleservice.com/jep/v1/customer", requestBody, httpHeader("Media-Type=text/xml"))
Note: Refer to the
httpHeaders
function for additional details.
This function groups together a variable number of string arguments containing HTTP header entries for usage with the http()
and httpGet()
functions. Each entry is a string containing a key, a separator, and a value. A separator can be either an equal sign (=
) or a colon (:
). For example, an entry can be defined as "Accept=text/xml"
or "Accept:text/xml"
.
httpHeader("Accept=text/xml")
httpHeaders("Accept=text/xml", "Authentication=Basic dXNlcjpwYXNz")
Generates a basic authorization header from a given username and password.
basicAuthorizationHeader("Aladdin", "OpenSesame") //result: "Basic QWxhZGRpbjpPcGVuU2VzYW1l"
Returns the HTTP status code, given a WebServiceResponse
object, returned by the http()
function.
httpStatusCode(webServiceResponse)
Returns the HTTP response body as string, given a WebServiceResponse
object, returned by the http()
function.
httpResponse(webServiceResponse)