p:http-request — The standard p:http-request step.
The p:http-request step allows authors to interact
with resources over HTTP or related protocols. Implementations
must support the http and
https protocols.
| Input port | Primary | Sequence | Content types |
|---|
| source | ✔ | ✔ | any |
| Output port | Primary | Sequence | Content types |
|---|
| result | ✔ | ✔ | any |
| report | | | application/json |
| Option name | Type | Default value | Required |
|---|
| href | xs:anyURI | | ✔ |
| assert | xs:string | '.?status-code lt 400' | |
| auth | map(xs:string, item()+)? | () | |
| headers | map(xs:string, xs:string)? | () | |
| method | xs:string? | 'GET' | |
| parameters | map(xs:QName, item()*)? | () | |
| serialization | map(xs:QName,item()*)? | () | |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" type="p:http-request">
| <p:input port="source" content-types="any" sequence="true"/>
| <p:output port="result"
| primary="true"
5 | content-types="any"
| sequence="true"/>
| <p:output port="report" content-types="application/json"/>
| <p:option name="href" as="xs:anyURI" required="true"/>
| <p:option name="method" as="xs:string?" select="'GET'"/>
10 | <p:option name="serialization" as="map(xs:QName,item()*)?"/>
| <p:option name="headers" as="map(xs:string, xs:string)?"/>
| <p:option name="auth" as="map(xs:string, item()+)?"/>
| <p:option name="parameters" as="map(xs:QName, item()*)?"/>
| <p:option name="assert" as="xs:string" select="'.?status-code lt 400'"/>
15 |</p:declare-step>
Errors
| Code | Description |
|---|
err:XC0003 | It is a dynamic
error (err:XC0003) if a “username” or a
“password” key is present without specifying a
value for the “auth-method” key, if the requested
auth-method isn't supported, or the
authentication challenge contains an authentication method that
isn't supported. |
err:XC0030 | It
is a dynamic error (err:XC0030) if the response body cannot
be interpreted as requested (e.g. application/json
to override application/xml content). |
err:XC0078 | It is a
dynamic error (err:XC0078) if the value associated
with the “fail-on-timeout” is associated
with true() and a HTTP status code
408 is encountered. |
err:XC0122 | It is a dynamic error (err:XC0122) if
the given method is not supported. |
err:XC0123 | It is a dynamic error (err:XC0123) if any key
in the “auth” map is associated with a value that
is not an instance of the required type. |
err:XC0124 | It is a dynamic
error (err:XC0124) if any key in the “parameters” map is
associated with a value that is not an instance of the
required type. |
err:XC0125 | It is
a dynamic error (err:XC0125) if the key
“accept-multipart” as the value
false() and a multipart response is
detected. |
err:XC0126 | It is a
dynamic error (err:XC0126) if the XPath expression
in assert evaluates to
false. |
err:XC0127 | It is a dynamic error (err:XC0127) if
the headers map contains two keys that are the same
when compared in a case-insensitive manner. |
err:XC0128 | It is a dynamic error (err:XC0128) if the
URI’s scheme is unknown or not supported. |
err:XC0131 | It is a dynamic error (err:XC0131) if
the processor cannot support the requested encoding. |
err:XC0132 | It is a dynamic error (err:XC0132) if
the override content encoding cannot be supported. |
err:XC0133 | It is a dynamic error (err:XC0133)
if more than one document appears on the source port and
a content-type header is present and the content
type specified is not a multipart content type. |
err:XC0203 | It is a dynamic error (err:XC0203)
if the specified boundary is not valid (for example, if it begins with two hyphens “--”). |
err:XD0079 | It is a dynamic error (err:XD0079) if a supplied content-type is not
a valid media type of the form
“type/subtype+ext”
or “type/subtype”. |
Implementation defined features