Changes

Jump to navigation Jump to search
117 bytes removed ,  16:06, 26 May 2012
no edit summary
This [[Module Library|XQuery Module]] contains a single function to send HTTP requests and handle HTTP responses. The function <code>{{Code|send-request</code> }} is based on the [http://expath.org/spec/http-client EXPath HTTP Client Module]:
=Conventions=
All functions in this module are assigned to the <code>{{Code|http://expath.org/ns/http-client</code> }} namespace, which is statically bound to the <code>{{Code|http</code> }} prefix.<br/>All errors are assigned to the <code>{{Code|http://expath.org/ns/error</code> }} namespace, which is statically bound to the <code>{{Code|exerr</code> }} prefix.
=Functions=
|-
| width='90' | '''Signatures'''
|<code><b>{{Func|http:send-request</b>(|$request as element(http:request)?, $href as xs:string?, $bodies as item()*) as |item()+</code>}}<br/><code><b>{{Func|http:send-request</b>(|$request as element(http:request)) as |item()+</code>}}<br /><code><b>{{Func|http:send-request</b>(|$request as element(http:request)?, $href as xs:string?) as |item()+</code>}}<br />
|-
| '''Summary'''
|Sends an HTTP request and interprets the corresponding response. <code>{{Code|$request</code> }} contains the parameters of the HTTP request such as 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>{{Code|$href</code>}}, its value in <code>{{Code|$request</code> }} is used instead. The structure of <code>{{Code|http:request</code> }} element follows the [http://expath.org/spec/http-client EXPath] specification.
|-
|'''Errors'''
|-
| '''Notes'''
|The attribute <code>{{Code|auth-method</code> }} of <code>{{Code|$request</code> }} is not considered in our implementation because we are handling only basic authentication.
|}
===Status Only===
Simple GET request. As the attribute <code>{{Code|status-only</code> }} is set to true, only the response element is returned.
'''Query:'''
! width="95%"|Description
|-
|<code>{{Code|FOHC0001</code>}}
|An HTTP error occurred.
|-
|<code>{{Code|FOHC0002</code>}}
|Error parsing the entity content as XML or HTML.
|-
|<code>{{Code|FOHC0003</code>}}
|With a multipart response, the override-media-type must be either a multipart media type or application/octet-stream.
|-
|<code>{{Code|FOHC0004</code>}}
|The src attribute on the body element is mutually exclusive with all other attribute (except the media-type).
|-
|<code>{{Code|FOHC0005</code>}}
|The request element is not valid.
|-
|<code>{{Code|FOHC0006</code>}}
|A timeout occurred waiting for the response.
|}
[[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu