WmPublic. Issues an HTTP request that you specify and returns the HTTP response.
Input Parameters
url String URL of the resource that you want to access. For example:
http://www.rubicon.com/orders/orders.html
Important! This string must begin with http: or https:.
method String Specifies the HTTP method you want to use. Valid values
are: delete get head options post put trace
loadAs String Optional. Form in which you want the http service to store
the returned document. Set to:
bytes to return the body of the response as a byte[ ]. Use this option if the body will be used as input to a service that operates on whole HTML or XML documents (for example,
pub.xml:queryXMLNode). This is the default.
stream to return the body of the response as a
java.io.InputStream. Use this option if the document will be used as input to a service that can process documents incrementally (for example, pub.xml:getXMLNodeIterator).
data Document Data that you want the http service to submit with the
HTTP request. Specify data using one or more of the following keys.
Important! When you use more than one key, args is appended
first, table is appended second, and string is appended last.
Key Description
args Document Optional. Name/value pairs that you
want this service to submit to the resource in url. You can use args to submit data via the POST, PUT, GET, or HEAD method.
3 Client Folder
To specify data using args, create one String element for each name/value pair that you want to submit, where the element's name represents the name portion of the pair and the element's value represents the value portion of the pair.
When you use args, the http service will automatically:
URL-encode name/value pair, so you do not
need to URL-encode the values you specify in
args.
Insert the "&" character between pairs, so you do not need to include it in args.
Prefix the entire query string with the "?" character if it submits the data in args via a GET or HEAD. You do not need to include this character in args.
When you submit data using args, Integration Server automatically sets the value of the Content-
Type header to application/x-www-form-
urlencoded.
If you want to explicitly specify a different Content-Type value, you must submit the value using the string or bytes variable.
table String Table Optional. Data that the http service will
use to construct a query string to submit to the resource specified in url.
table is similar to args, but it allows you to submit
unnamed values in a query string, not just name/value pairs.
To specify data using table, create one row for each value that you want to submit, where the contents of column 0 of the String Table represents the name portion of the pair (leave this column null to submit an unnamed value) and the contents of column 1 represents the value portion of the pair.
3 Client Folder
When you use table, the http service will automatically:
URL-encode name/value pair, so you do not
need to URL-encode the values you specify in
table.
Insert the "&" character between the pairs (or unnamed values) that it constructs, so you do not need to include it in table.
Prefix the entire query string with the "?" character if it submits the data in table via the GET method. You do not need to include this character in table.
When you submit data using table, Integration Server automatically sets the value of the Content-
Type header to application/x-www-form-
urlencoded. If you want to explicitly specify a different Content-Type, you must submit your data using the string or bytes variable.
string String Optional. Text that you want the http service
to submit to the resource in url. You can use string to submit data via the POST, PUT, GET, or HEAD method.
If you use string to submit data, make sure that you specify the string exactly as you want it presented in the HTTP request. (If you are using the GET or HEAD method, make sure you URL- encode the contents of string.)
Note: When you use string, the http service will
automatically prefix the entire query string with "?" if it submits the data in string via a GET or HEAD. You do not need to include this character in string.
When performing a POST or PUT, string will be submitted to the resource defined by url as the body of the request message.
3 Client Folder
bytes byte[ ] Optional. Data that you want this service to
submit to the resource in url. You can use bytes to submit data via the POST or PUT methods only.
Important! When you use bytes and another element
(args, table, or string) to specify data, the service appends the data from the args, table, or string element to url. The service appends args to url first,
table second, and string last. The service encodes
the data from the bytes element in the body of the post. If the stream variable is not null, bytes is ignored.
mimeStream Java.io.InputStream Optional. MIME or SMIME
message that you want this service to submit to the resource in url. A mimeStream is created by the
pub.mime:getEnvelopeStream,
pub.smime:createEncryptedData,
pub.smime:createSignedData,
pub.smime.keystore:createSignedData or services. It contains both headers and content. The headers in the mimeStream are appended to the http headers. You can use mimeStream to submit data via the POST or PUT methods only.
stream java.io.InputStream Optional. Data that you want the
http service to submit to the resource in url. You can use stream to submit data via the POST or PUT methods only.
Important! When you use stream and another
element (args, table, string or bytes) to specify data, the service appends the data from the args, table, or
string element to url. The service appends args to url first, table second, and string last. The service
encodes the data from the stream element in the body of the post. If the stream input is not null, the
3 Client Folder
encoding String Optional. Character set in which the URL data parameters are encoded (args or table and/or string). Encoding is required to correctly convert
the String object to bytes when generating the URL for a post. Specify an IANA-registered character set (for example, ISO-8859-1).
If this variable is null, the default JVM encoding is used. Because string is used in the body of the post and not used for building the URL, you do not need to specify encoding for the data parameter
string.
auth Document Optional. Authorization information that the http
service will submit if the resource specified in url is protected.
Key Description
type String Type of authentication scheme that you
want this service to use when it submits this request. Set to:
Basic to submit a user name and password.
This is the default.
Bearer to submit authorization information for
an OAuth resource server.
user String User name that this service will submit
when requesting a protected resource.
pass String Password associated with user.
token String The access token to submit to the OAuth
resource server. Required only when type is set to Bearer.
headers Document Optional. Fields that you want to explicitly override in
the HTTP request header issued by the http service.
Specify a key in headers for each header field that you want to set, where the key's name represents the name of the header field and the key's value represents the value of that header field. If you do not set headers, the http service uses its default header values.
3 Client Folder
timeout String Optional. Time (measured in milliseconds) to wait for a
response from the remote server before timing out and terminating the request. The default value is defined by the watt.net.timeout server configuration parameter. The default value for the watt.net.timeout server configuration parameter is 300 seconds (30000 milliseconds).
For information about the watt.net.timeout server configuration parameter, see webMethods Integration Server Administrator’s
Guide. maxKeepAlive
Connections
String Optional. Number of client keep alive connections that you
want Integration Server to retain in the client connection pool it uses for this HTTP connection.
Integration Server establishes a client connection pool for each protocol (i.e., HTTP or HTTPS), host, and port combination. How the service uses this input value differs based on whether a suitable client connection pool already exists for the HTTP connection.
If a suitable pool already exists, Integration Server uses a connection from the pool for the HTTP request. If the specified maxKeepAliveConnections is different from what is currently being used for the pool, Integration Server updates the pool to use the value you specify.
If a suitable pool does not exist, Integration Server establishes one, using the maximum connections defined by this
parameter. If you do not specify a value, the service uses the default value defined by the
watt.net.maxClientKeepAliveConns server configuration parameter. After establishing the client connection pool, the service uses a connection from the newly established connection pool to the HTTP request.
3 Client Folder
keepAliveTimeout String Optional. Number of seconds that you want Integration
Server to keep an idle connection in the client connection pool before closing it.
Integration Server establishes a client connection pool for each protocol (i.e., HTTP or HTTPS), host, and port combination. How the service uses this input value differs based on whether a suitable client connection pool already exists for the HTTP connection.
If a suitable pool already exists, Integration Server uses a connection from the pool for the HTTP request. If the
specified keepAliveTimeout is different from what is currently being used for the pool, Integration Server updates the pool to use the value you specify.
If a suitable pool does not exist, Integration Server establishes one, using the timeout value defined by this parameter. If you do not specify a value, the service uses the default value defined by the watt.net.clientKeepAliveTimeout server configuration parameter. After establishing the client connection pool, the service uses a connection from the newly established connection pool to the HTTP request.
newSession String Optional. Flag indicating whether a new session will be
created for this HTTP request. This parameter overrides the watt.server.new.http.session.context server configuration parameter. For information about the
watt.server.new.http.session.context server configuration parameter, see webMethods Integration Server Administrator’s
Guide.
Set to:
no to use the current session, if one is available, for this HTTP request. This is the default.
3 Client Folder
Output Parameters
proxyAlias String Optional. Name of the proxy alias for the proxy server to
which Integration Server routes the HTTP request.
If you do not specify a proxyAlias, Integration Server routes the HTTP request through the proxy server specified in the default HTTP proxy alias. If there is no default HTTP proxy alias, the action taken by Integration Server depends on the value specified for the watt.net.proxy.useNonDefaultProxies parameter.
If the watt.net.proxy.useNonDefaultProxies parameter is set to true, Integration Server routes the HTTP request through the proxy server in any configured HTTP proxy alias. If the Integration Server does not have any defined HTTP proxy aliases, Integration Server sends the HTTP request directly to the HTTP server or throws an exception depending on the settings specified for the
watt.net.proxy.fallbackToDirectConnection parameter.
If the watt.server.proxy.useNonDefaultProxies parameter is
set to false, Integration Server sends the request to the remote server using a direct connection.
For more information about proxy server usage, refer to
webMethods Integration Server Administrator’s Guide.
connectTimeout String Optional. Time (measured in milliseconds) the server will
wait to connect to the remote server before timing out and terminating the request.
This parameter can be used to override the operating system parameter that controls the connection timeouts. If a value for
connectTimeout is not specified or is set to 0, the server will wait
for the timeout value defined by the operating system before terminating the connection request.
encodedURL String The URL that was submitted by pub.client:http. This will
contain any argument set in args, table, or string.
header Document Conditional. HTTP response headers.
Key Description
lines Document Fields in the response header,
where key names represent field names and values represent field values.
status String HTTP status code of the response. statusMessage String HTTP status message of the response.
3 Client Folder
Usage Notes
If url begins with https:, you can use pub.security:setKeyAndChain to specify the certificate chain. If you do not specify a certificate chain, pub.client:http uses the default outbound SSL certificate settings to authenticate the resources.
If pub.client:http does not receive a response within the time-out period specified in the server's watt.net.timeout server configuration parameter, it will throw an exception. For information about the watt.net.timeout server configuration parameter, see webMethods
Integration Server Administrator’s Guide.
For the HTTP request, the pub.client:http service uses a client connection from a client connection pool. When you set the loadAs input parameter to stream so that the service returns the response body as a stream, the connection remains in use and is not returned to the connection pool until you close the stream. To close the stream and return the connection to the pool, you can use the pub.io:close service or the close() method on the returned stream object.