Difference between revisions of "HTTP Client Module"

From BaseX Documentation
Jump to navigation Jump to search
Line 11: Line 11:
 
|-
 
|-
 
| valign='top' | '''Rules'''
 
| valign='top' | '''Rules'''
|<code>$request</code> contains the parameters of the HTTP request like HTTP method and headers. In addition to this it can also contain the URI to which the request will be sent and the body of the HTTP method. If the URI is not given with the parameter <code>$href</code>, its value in <code>$request</code> is used instead. The structures of <code>http:request</code>, <code>http:header</code> and <code>http:body</code> elements follow the [http://expath.org/spec/http-client EXPath] specification. The attribute <code>auth-method</code> of <code>$request</code> is not considered in our implementation because we are handling only basic authentication. Furthermore, currently if any serialization parameters are provided in the <code>http:body</code> child of <code>$request</code>, they are always considered, i.e. the case when the <code>src</code> attribute is set, is not handled. Sending of multipart HTTP requests and handling of responses with content different from XML, HTML and text is not supported.<br />
+
|<code>$request</code> contains the parameters of the HTTP request like HTTP method and headers. In addition to this it can also contain the URI to which the request will be sent and the body of the HTTP method. If the URI is not given with the parameter <code>$href</code>, its value in <code>$request</code> is used instead. The structures of <code>http:request</code>, <code>http:header</code> and <code>http:body</code> elements follow the [http://expath.org/spec/http-client EXPath] specification. The attribute <code>auth-method</code> of <code>$request</code> is not considered in our implementation because we are handling only basic authentication. Furthermore, if any serialization parameters are provided in the <code>http:body</code> child of <code>$request</code>, they are always considered, i.e. the case when the <code>src</code> attribute is set, is not handled. Sending of multipart HTTP requests and handling of responses with content different from XML, HTML and text might be supported in future, depending on our user requests.<br />
 
|}
 
|}
  
 
[[Category:XQuery]]
 
[[Category:XQuery]]

Revision as of 19:03, 21 January 2011

The HTTP client module contains an XQuery Function to send HTTP requests and handle HTTP responses. The function send-request, which is preceded by the http: prefix, is based on the EXPath specification:

http:send-request

Signatures http:send-request($request as element(http:request)) as item()+
http:send-request($request as element(http:request)?, $href as xs:string?) as item()+
Summary Sends an HTTP request and interprets the corresponding response.
Rules $request contains the parameters of the HTTP request like HTTP method and headers. In addition to this it can also contain the URI to which the request will be sent and the body of the HTTP method. If the URI is not given with the parameter $href, its value in $request is used instead. The structures of http:request, http:header and http:body elements follow the EXPath specification. The attribute auth-method of $request is not considered in our implementation because we are handling only basic authentication. Furthermore, if any serialization parameters are provided in the http:body child of $request, they are always considered, i.e. the case when the src attribute is set, is not handled. Sending of multipart HTTP requests and handling of responses with content different from XML, HTML and text might be supported in future, depending on our user requests.