HTTP Client Module

http://expath.org/ns/http-client

This module is statically bound to the prefix "http".

Description
HTTP Client Module to perform HTTP requests.
Specified: http://expath.org/spec/http-client
Functions

http:send-request


Signature
http:send-request($request as element(http:request)?) as item()+
http:send-request($request as element(http:request)?, $href as xs:string?) as item()+

http:send-request($request as element(http:request)?, $href as xs:string?, $bodies as item()*) as item()+
Description
Send an HTTP request and return the corresponding response.
  • $request contains the various parameters of the request, for instance the HTTP method to use or the HTTP headers. Among other things, it can also contain the other param's values: the URI and the bodies. If they are not set as parameter to the function, their value in $request, if any, is used instead. See the following section for the detailed definition of the http:request element. If the parameter does not follow the grammar defined in this spec, this is an error [err:HC005].

  • $href is the HTTP or HTTPS URI to send the request to. It is an xs:anyURI, but is declared as a string to be able to pass literal strings (without requiring to explicitly cast it to an xs:anyURI).

  • $bodies is the request body content, for HTTP methods that can contain a body in the request (e.g. POST). This is an error if this param is not the empty sequence for methods that must be empty (e.g. DELETE). The details of the methods are defined in their respective specs (e.g. [RFC 2616] or [RFC 4918]). In case of a multipart request, it can be a sequence of several items, each one is the body of the corresponding body descriptor in $request. See below for details.

back to top