Transaction System API

ServiceResponse extends XMLReader

Method Summary
String getCompression()

Returns the compression (gzip or deflate), if any, of the response.

Payload getConnectionInfo()

Returns DNS, domain, and certificate information about this request. See ServiceRequest.checkConnection().

String getCookie(String name)

Returns cookie by name

File getFile(String xpath, String filename, String contentType)

Locates text node by xpath expression and creates a File object for it. Content of node should be base64 encoded. File.isValid will indicate success of the operation

int getResponseCode()

Returns response code

String getResponseHeader(String name)

Returns response header value

Data getResponseHeaders()

Returns response headers

int getResponseLength()

Returns the length of the response body in bytes.

String getResponseMessage()

Returns response message

long getResponseTime()

Returns the response time in milliseconds it took for this request.

String getUrl()

Returns the URL of this connection if available.

boolean isError()

Returns true if request was not submitted successfully, false otherwise

boolean isSuccess()

Returns true if request was submitted successfully, false otherwise

Data readAllTextData(String xpath)

Creates data object by evaluating xpath expression on response body from first matching element using all descendant elements' names as keys and text nodes as values. Fails if response body is not xml.

Data readAttributeData(String xpath)

Creates data object by evaluating xpath expression on response body using attributes of first matching element. Fails if response body is not xml

DataList readAttributeDataList(String name, String xpath)

Creates datalist object by evaluating xpath expression on response body using attributes of matching elements. Fails if response body is not xml

String readBody()

Reads the body of the response. Returns null if there is no body or the body exceeds the maximum upload allowed by the activation key.

String readJSON()

Reads the body of the response and converts it to JSON if it is XML. Returns null if there is no body or the body exceeds the maximum upload allowed by the activation key.

Data readJSONData(String varName)
⚠Deprecated since 05-17-2016. Use Controller.createJsonParser(response.readBody())

Creates data object from javascript object notation string. varName should specify property containing associative array with required data. Specify null or empty string to use entire notation. Fails if response body is not JSON

DataList readJSONDataList(String name, String varName)
⚠Deprecated since 05-17-2016. Use Controller.createJsonParser(response.readBody())

Creates datalist object from javascript object notation string. varName should specify property containing array with required datalist. Fails if response body is not JSON

String readNodeText(String xpath)

Returns text of the first node selected by xpath expression. If node is an attribute then attribute value returned. If node is an element then element's text contents returned. Fails if response body is not xml

Data readTextData(String xpath)

Creates data object by evaluating xpath expression on response body from first matching element using children elements' names as keys and text nodes as values. Fails if response body is not xml.

DataList readTextDataList(String name, String xpath)

Creates datalist object by evaluating xpath expression on response body from matching elements using children elements' names as keys and text nodes as values. Fails if response body is not xml

  removeNamespaces()

Removes namespaces from the payload XML so the content can be queried with XPATH.

  setEncoding(String encoding)

Sets the encoding to be used for reading the payload

File toBinaryFile(String fileName)
⚠Deprecated since 06-25-2018. Use toFile()

Returns raw content of this response as binary file. Content type of file will be based on file name and must be one of upload types supported by platform.

File toFile(String fileName)

Returns the content of this response as a File.

File toFile(String fileName, boolean asPdf)
⚠Deprecated since 06-25-2018. Use toFile().toPdf()

Returns the content of this response as a File. If asPdf=true, the file will be returned as PDF, otherwise as xml or json depending on the file extension. If no extension, xml will be assumed.

XMLReader transform(Fragment fragment)
⚠Deprecated since 07-18-2018. Use removeNamespaces()

Performs a transform using the XSLT in the fragment and returns a new ServicePayload.

String urlDecode(String value)

Performs URL-decoding of specified value

Method Detail


String getCompression()

Returns the compression (gzip or deflate), if any, of the response.

Returns:  String

Since: 02-08-2023

top

Payload getConnectionInfo()

Returns DNS, domain, and certificate information about this request. See ServiceRequest.checkConnection().

Returns:  Payload

Since: 07-12-2013

top

String getCookie(String name)

Returns cookie by name

Parameters:

  • String   name  - cookie name. Required parameter.

Returns:  String

Since: 05-31-2009

top

File getFile(String xpath, String filename, String contentType)

Locates text node by xpath expression and creates a File object for it. Content of node should be base64 encoded. File.isValid will indicate success of the operation

Parameters:

  • String   xpath
  • String   filename
  • String   contentType

Returns:  File

Since: 02-01-2010

top

int getResponseCode()

Returns response code

Returns:  int

Since: 12-22-2009

top

String getResponseHeader(String name)

Returns response header value

Parameters:

  • String   name

Returns:  String

Since: 12-22-2009

top

Data getResponseHeaders()

Returns response headers

Returns:  Data

Since: 12-22-2009

top

int getResponseLength()

Returns the length of the response body in bytes.

Returns:  int

Since: 01-20-2010

top

String getResponseMessage()

Returns response message

Returns:  String

Since: 12-22-2009

top

long getResponseTime()

Returns the response time in milliseconds it took for this request.

Returns:  long

Since: 06-16-2021

top

String getUrl()

Returns the URL of this connection if available.

Returns:  String

Since: 06-16-2021

top

boolean isError()

Returns true if request was not submitted successfully, false otherwise

Returns:  boolean

Since: 12-22-2009

top

boolean isSuccess()

Returns true if request was submitted successfully, false otherwise

Returns:  boolean

Since: 12-22-2009

top

Data readAllTextData(String xpath)

Creates data object by evaluating xpath expression on response body from first matching element using all descendant elements' names as keys and text nodes as values. Fails if response body is not xml.

Parameters:

  • String   xpath

Returns:  Data

Since: 07-12-2011

top

Data readAttributeData(String xpath)

Creates data object by evaluating xpath expression on response body using attributes of first matching element. Fails if response body is not xml

Parameters:

  • String   xpath

Returns:  Data

Since: 12-22-2009

top

DataList readAttributeDataList(String name, String xpath)

Creates datalist object by evaluating xpath expression on response body using attributes of matching elements. Fails if response body is not xml

Parameters:

  • String   name
  • String   xpath

Returns:  DataList

Since: 12-22-2009

top

String readBody()

Reads the body of the response. Returns null if there is no body or the body exceeds the maximum upload allowed by the activation key.

Returns:  String

Since: 01-20-2010

top

String readJSON()

Reads the body of the response and converts it to JSON if it is XML. Returns null if there is no body or the body exceeds the maximum upload allowed by the activation key.

Returns:  String

Since: 11-08-2016

top

Data readJSONData(String varName)

Creates data object from javascript object notation string. varName should specify property containing associative array with required data. Specify null or empty string to use entire notation. Fails if response body is not JSON

Parameters:

  • String   varName

Returns:  Data

Since: 12-22-2009

This method has been deprecated since 05-17-2016. Use Controller.createJsonParser(response.readBody())

top

DataList readJSONDataList(String name, String varName)

Creates datalist object from javascript object notation string. varName should specify property containing array with required datalist. Fails if response body is not JSON

Parameters:

  • String   name
  • String   varName

Returns:  DataList

Since: 12-22-2009

This method has been deprecated since 05-17-2016. Use Controller.createJsonParser(response.readBody())

top

String readNodeText(String xpath)

Returns text of the first node selected by xpath expression. If node is an attribute then attribute value returned. If node is an element then element's text contents returned. Fails if response body is not xml

Parameters:

  • String   xpath

Returns:  String

Since: 12-24-2009

top

Data readTextData(String xpath)

Creates data object by evaluating xpath expression on response body from first matching element using children elements' names as keys and text nodes as values. Fails if response body is not xml.

Parameters:

  • String   xpath

Returns:  Data

Since: 12-22-2009

top

DataList readTextDataList(String name, String xpath)

Creates datalist object by evaluating xpath expression on response body from matching elements using children elements' names as keys and text nodes as values. Fails if response body is not xml

Parameters:

  • String   name
  • String   xpath

Returns:  DataList

Since: 12-22-2009

top

removeNamespaces()

Removes namespaces from the payload XML so the content can be queried with XPATH.

Since: 07-18-2018

top

setEncoding(String encoding)

Sets the encoding to be used for reading the payload

Parameters:

  • String   encoding Required parameter. Allowed values: utf-8, iso-8859-1, utf-16, windows-1252.

Since: 03-05-2021

top

File toBinaryFile(String fileName)

Returns raw content of this response as binary file. Content type of file will be based on file name and must be one of upload types supported by platform.

Parameters:

  • String   fileName Required parameter.

Returns:  File

Since: 12-27-2010

This method has been deprecated since 06-25-2018. Use toFile()

top

File toFile(String fileName)

Returns the content of this response as a File.

Parameters:

  • String   fileName Required parameter.

Returns:  File

Since: 06-25-2018

top

File toFile(String fileName, boolean asPdf)

Returns the content of this response as a File. If asPdf=true, the file will be returned as PDF, otherwise as xml or json depending on the file extension. If no extension, xml will be assumed.

Parameters:

  • String   fileName Required parameter.
  • boolean   asPdf Required parameter.

Returns:  File

Since: 08-27-2010

This method has been deprecated since 06-25-2018. Use toFile().toPdf()

top

XMLReader transform(Fragment fragment)

Performs a transform using the XSLT in the fragment and returns a new ServicePayload.

Parameters:

  • Fragment   fragment Required parameter.

Returns:  XMLReader

Since: 08-27-2010

This method has been deprecated since 07-18-2018. Use removeNamespaces()

top

String urlDecode(String value)

Performs URL-decoding 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