Transaction System API

ServiceRequest

Method Summary
  addData(Data data)

Adds data to request body. Used if request body created from fragment

  addDataList(DataList datalist)

Adds datalist to request body. Used if request body created from fragment

  checkConnection(boolean enabled)

Enables DNS and certificate details (if any) to be gathered during the request and provided in Response.getConnectionInfo().

  clearFormParameters()

Removes all for parameters set for this request

  clearHeaders()

Removes all request headers set for this request

XMLReader createServicePayload(Attachment attachment)

Creates an XMLReader from the contents of the attachment. This is primarily used for testing or re-analyzing a stored response. The attachment must be XML.

XMLReader createServicePayload(File file)

Creates an XMLReader from the contents of the file. This is primarily used for testing or re-analyzing a stored response. The file must be XML.

  echo(boolean enabled)

If enabled, this tells the ServiceRequest to bundle the request and submit to itself. Credentials are masked. This is used for troubleshooting requests so developers can analyze the payload and headers being sent.

Data getFormParameters()

Returns a read-only copy of the form parameters for this request.

ServiceResponse getLastResponse()

Returns last response for this request. This method returns null if the request wasn't submitted yet

String resolveHost(String host)

Returns the resolved IP address of the host

  setAWS(String accessKeyId, String secretAccessKey, String region, String service)

Configures this request for AWS authentication.

  setAWSProvider(StorageProvider storageProvider, String service)

Configures this request for AWS authentication using credentials and region from the specified storage provider. Works only for AWS S3 provider settings.

  setAttachment(String varName, Attachment attachment)

Adds the attachment. Content is set as base64

  setAuthenticationPreemptive(boolean enabled)

Enables preemptive authentication mode. In this mode ServiceRequest will send the basic authentication even before the server gives an unauthorized response in certain situations, thus reducing the overhead of making the connection. This method has effect only if authentication is controlled by ServiceRequest (true by default), see setSendAuthorization()

  setBasicAuthorization(String name, String password)

Sets basic authorization for this request. Note: this method has no effect if request submitted using connector settings

  setContentType(String contentType)

Sets content type of this request. Default value is application/xml

  setCoreDocument(String varName, Document doc)

Adds the XML of the dta:Document element including all references. Content is set as base64.

  setEncoding(String encoding)

Sets (or removes) the character encoding of the request. Default is UTF-8.

  setFile(String varName, File file)

Adds the file. Content is set as base64

  setFormParameter(String name, String value)

Sets request form parameter. Note: this method has no effect for POST and PUT methods if request body set from fragment or string

  setFormParameters(Data data)

Sets request form parameters from data. Note: this method has no effect for POST and PUT methods if request body set from fragment or string

  setFragment(Fragment fragment)

Set fragment of type "service request" as this request body

  setFragmentFormParameter(String name, Fragment value)

Sets request form parameter from fragment. Note: this method has no effect for POST and PUT methods if request body set from fragment or string

  setIgnoreStatusCodes(boolean ignore)

Allows to ignore http status code of response and use response body in error state. Useful for dealing with SOAP

  setMethod(String method)

Sets http method for this request. Default is POST. Note that only POST and PUT methods will allow to send request body

  setNTLMAuthorization(String name, String password, String domain)

Sets NTLM authorization for this request. Note: this method has no effect if request submitted using connector settings

  setOauth(String privateKey, Data params)

Configures this request for OAuth authentication. Standard oauth parameters in the Data are used to construct the Authorization header. The platform will construct the minimum necessary and pass through any parameters not needing to be changed during signature calculations. Required data elements: oauth_consumer_secret (for hmac-sha1), oauth_consumer_key, and oauth_signature_method (should be rsa-sha1, hmac-sha1, or plaintext). You may also provide oauth_nonce and oauth_timestamp if desired (i.e. for testing) but these will be provided if not present.

  setPacket(String varName, Packet packet)

Adds the XML of the entire transaction packet without a dsig wrapper. Content is set as base64

  setPdfDocument(String varName, Document doc)

Adds the doc as a PDF. If the document is not already PDF it is converted to PDF. Content is set as base64.

  setRequestBody(String body)

Sets free-form string request body. Useful for request with JSON body

  setRequestHeader(String header, String value)

Adds request header or removes it if value is null

  setSendAuthorization(boolean send)

Enables or disables sending HTTP authorization header if user and password specified. Allows to control authorization manually. Enabled by default.

  setTimeout(int connectTimeout, int dataTimeout)

Sets the maximum timeout for the connection to (a) connect and (b) wait for data before terminating the connection. Default is 15 seconds for connect and 30 seconds for data.

  sign(String signatureId, String key)

Completes the digital signature identified by signatureId.

ServiceResponse submit(String url, boolean failOnSSLError)
⚠Deprecated since 10-08-2015. Use submit(url,failOnSSLHandshake,allowRedirect

Security Note: this method is deprecated and now considered insecure. Submits request to specified url. failOnSSLError used for https connections. If failOnSSLError set to true request will fail if remote host certificate do not pass validation. Check response code and message.

ServiceResponse submit(String url, boolean failOnSSLHandshake, boolean allowRedirect)

Submits request to specified url. failOnSSLError used for https connections. If failOnSSLError set to true request will fail if remote host certificate do not pass validation. allowRedirect=false is more secure and should be used if you know the remote service does not forward requests to a new location. Check response code and message.

ServiceResponse submitUsingConnector(String connector)

Submits request using connector settings defined for enterprise

ServiceResponse submitUsingConnector(String connector, String url)

Submits request using connector settings defined for enterprise. Allows to redefine url for submit. Url can be absolute or relative. Relative urls are appended to the connector url.

String urlEncode(String value)

Performs URL-encoding of specified value

Method Detail


addData(Data data)

Adds data to request body. Used if request body created from fragment

Parameters:

Since: 12-22-2009

top

addDataList(DataList datalist)

Adds datalist to request body. Used if request body created from fragment

Parameters:

Since: 12-22-2009

top

checkConnection(boolean enabled)

Enables DNS and certificate details (if any) to be gathered during the request and provided in Response.getConnectionInfo().

Parameters:

  • boolean   enabled

Since: 07-12-2013

top

clearFormParameters()

Removes all for parameters set for this request

Since: 12-23-2009

top

clearHeaders()

Removes all request headers set for this request

Since: 12-23-2009

top

XMLReader createServicePayload(Attachment attachment)

Creates an XMLReader from the contents of the attachment. This is primarily used for testing or re-analyzing a stored response. The attachment must be XML.

Parameters:

Returns:  XMLReader

Since: 08-27-2010

top

XMLReader createServicePayload(File file)

Creates an XMLReader from the contents of the file. This is primarily used for testing or re-analyzing a stored response. The file must be XML.

Parameters:

  • File   file Required parameter.

Returns:  XMLReader

Since: 08-27-2010

top

echo(boolean enabled)

If enabled, this tells the ServiceRequest to bundle the request and submit to itself. Credentials are masked. This is used for troubleshooting requests so developers can analyze the payload and headers being sent.

Parameters:

  • boolean   enabled

Since: 09-27-2010

top

Data getFormParameters()

Returns a read-only copy of the form parameters for this request.

Returns:  Data

Since: 06-16-2021

top

ServiceResponse getLastResponse()

Returns last response for this request. This method returns null if the request wasn't submitted yet

Returns:  ServiceResponse

Since: 12-22-2009

top

String resolveHost(String host)

Returns the resolved IP address of the host

Parameters:

  • String   host

Returns:  String

Since: 03-25-2016

top

setAWS(String accessKeyId, String secretAccessKey, String region, String service)

Configures this request for AWS authentication.

Parameters:

  • String   accessKeyId  - Access Key ID. Required parameter.
  • String   secretAccessKey  - Secret Access Key. Required parameter.
  • String   region  - Region, e.g. us-west-1. Required parameter.
  • String   service  - Service, e.g. ec2. Required parameter.

Since: 11-07-2016

top

setAWSProvider(StorageProvider storageProvider, String service)

Configures this request for AWS authentication using credentials and region from the specified storage provider. Works only for AWS S3 provider settings.

Parameters:

  • StorageProvider   storageProvider Required parameter.
  • String   service  - Service, e.g. ec2. Required parameter.

Since: 01-08-2020

top

setAttachment(String varName, Attachment attachment)

Adds the attachment. Content is set as base64

Parameters:

  • String   varName  - variable name. Required parameter.
  • Attachment   attachment Required parameter.

Since: 05-31-2010

top

setAuthenticationPreemptive(boolean enabled)

Enables preemptive authentication mode. In this mode ServiceRequest will send the basic authentication even before the server gives an unauthorized response in certain situations, thus reducing the overhead of making the connection. This method has effect only if authentication is controlled by ServiceRequest (true by default), see setSendAuthorization()

Parameters:

  • boolean   enabled  - enable or disable preemptive authentication.

Since: 08-25-2010

top

setBasicAuthorization(String name, String password)

Sets basic authorization for this request. Note: this method has no effect if request submitted using connector settings

Parameters:

  • String   name
  • String   password

Since: 12-22-2009

top

setContentType(String contentType)

Sets content type of this request. Default value is application/xml

Parameters:

  • String   contentType

Since: 12-22-2009

top

setCoreDocument(String varName, Document doc)

Adds the XML of the dta:Document element including all references. Content is set as base64.

Parameters:

  • String   varName  - variable name. Required parameter.
  • Document   doc Required parameter.

Since: 05-31-2010

top

setEncoding(String encoding)

Sets (or removes) the character encoding of the request. Default is UTF-8.

Parameters:

  • String   encoding Maximum allowed size of parameter: 100

Since: 06-13-2013

top

setFile(String varName, File file)

Adds the file. Content is set as base64

Parameters:

  • String   varName  - variable name. Required parameter.
  • File   file Required parameter.

Since: 05-31-2010

top

setFormParameter(String name, String value)

Sets request form parameter. Note: this method has no effect for POST and PUT methods if request body set from fragment or string

Parameters:

  • String   name
  • String   value

Since: 12-23-2009

top

setFormParameters(Data data)

Sets request form parameters from data. Note: this method has no effect for POST and PUT methods if request body set from fragment or string

Parameters:

Since: 12-23-2009

top

setFragment(Fragment fragment)

Set fragment of type "service request" as this request body

Parameters:

Since: 12-22-2009

top

setFragmentFormParameter(String name, Fragment value)

Sets request form parameter from fragment. Note: this method has no effect for POST and PUT methods if request body set from fragment or string

Parameters:

Since: 12-23-2009

top

setIgnoreStatusCodes(boolean ignore)

Allows to ignore http status code of response and use response body in error state. Useful for dealing with SOAP

Parameters:

  • boolean   ignore

Since: 02-01-2010

top

setMethod(String method)

Sets http method for this request. Default is POST. Note that only POST and PUT methods will allow to send request body

Parameters:

  • String   method

Since: 12-22-2009

top

setNTLMAuthorization(String name, String password, String domain)

Sets NTLM authorization for this request. Note: this method has no effect if request submitted using connector settings

Parameters:

  • String   name
  • String   password
  • String   domain

Since: 12-22-2009

top

setOauth(String privateKey, Data params)

Configures this request for OAuth authentication. Standard oauth parameters in the Data are used to construct the Authorization header. The platform will construct the minimum necessary and pass through any parameters not needing to be changed during signature calculations. Required data elements: oauth_consumer_secret (for hmac-sha1), oauth_consumer_key, and oauth_signature_method (should be rsa-sha1, hmac-sha1, or plaintext). You may also provide oauth_nonce and oauth_timestamp if desired (i.e. for testing) but these will be provided if not present.

Parameters:

  • String   privateKey  - Base64 encoded private key, required if oauth_signature_method is rsa-sha1.
  • Data   params

Since: 01-13-2015

top

setPacket(String varName, Packet packet)

Adds the XML of the entire transaction packet without a dsig wrapper. Content is set as base64

Parameters:

  • String   varName  - variable name. Required parameter.
  • Packet   packet Required parameter.

Since: 05-31-2010

top

setPdfDocument(String varName, Document doc)

Adds the doc as a PDF. If the document is not already PDF it is converted to PDF. Content is set as base64.

Parameters:

  • String   varName  - variable name. Required parameter.
  • Document   doc Required parameter.

Since: 05-31-2010

top

setRequestBody(String body)

Sets free-form string request body. Useful for request with JSON body

Parameters:

  • String   body

Since: 12-22-2009

top

setRequestHeader(String header, String value)

Adds request header or removes it if value is null

Parameters:

  • String   header Required parameter.
  • String   value

Since: 12-22-2009

top

setSendAuthorization(boolean send)

Enables or disables sending HTTP authorization header if user and password specified. Allows to control authorization manually. Enabled by default.

Parameters:

  • boolean   send  - enable or disable auth header. True by default.

Since: 06-09-2010

top

setTimeout(int connectTimeout, int dataTimeout)

Sets the maximum timeout for the connection to (a) connect and (b) wait for data before terminating the connection. Default is 15 seconds for connect and 30 seconds for data.

Parameters:

  • int   connectTimeout Maximum allowed size of parameter: 30
  • int   dataTimeout Maximum allowed size of parameter: 300

Since: 07-24-2013

top

sign(String signatureId, String key)

Completes the digital signature identified by signatureId.

Parameters:

  • String   signatureId Required parameter.
  • String   key  - base64 encoded key. Required parameter.

Since: 03-21-2013

top

ServiceResponse submit(String url, boolean failOnSSLError)

Security Note: this method is deprecated and now considered insecure. Submits request to specified url. failOnSSLError used for https connections. If failOnSSLError set to true request will fail if remote host certificate do not pass validation. Check response code and message.

Parameters:

  • String   url
  • boolean   failOnSSLError

Returns:  ServiceResponse

Since: 12-22-2009

This method has been deprecated since 10-08-2015. Use submit(url,failOnSSLHandshake,allowRedirect

top

ServiceResponse submit(String url, boolean failOnSSLHandshake, boolean allowRedirect)

Submits request to specified url. failOnSSLError used for https connections. If failOnSSLError set to true request will fail if remote host certificate do not pass validation. allowRedirect=false is more secure and should be used if you know the remote service does not forward requests to a new location. Check response code and message.

Parameters:

  • String   url Required parameter.
  • boolean   failOnSSLHandshake
  • boolean   allowRedirect

Returns:  ServiceResponse

Since: 10-08-2015

top

ServiceResponse submitUsingConnector(String connector)

Submits request using connector settings defined for enterprise

Parameters:

  • String   connector

Returns:  ServiceResponse

Since: 12-22-2009

top

ServiceResponse submitUsingConnector(String connector, String url)

Submits request using connector settings defined for enterprise. Allows to redefine url for submit. Url can be absolute or relative. Relative urls are appended to the connector url.

Parameters:

  • String   connector  - name of http(s) connector. Required parameter.
  • String   url  - url for submit. If null or empty string specified then url from connector will be used.

Returns:  ServiceResponse

Since: 07-21-2010

top

String urlEncode(String value)

Performs URL-encoding of specified value

Parameters:

  • String   value

Returns:  String

Since: 12-22-2009

top
Copyright © 2006 - 2024, ContractPal, Inc. All rights reserved. API Date: May 01, 2024 05:15 AM