executeGetMethod() and executePostMethod()
You can make multiple calls to executeGetMethod() and executePostMethod() within an application. In this case, do not perform a logout() after each call. Call logout() after all calls to executeGetMethod() and executePostMethod(). Both executeGetMethod() and executePostMethod() throw a LawsonHttpClientException.
executeGetMethod() parameters
Upon a successful login attempt, executeGetMethod() does something. You can call the executeGetMethod() method with a url parameter, or with a url and timeout parameter. The executeGetMethod() method returns a ResponseObject.
Parameter | Type | What it contains |
---|---|---|
url | String | The URL that contains the data you want to access. This is, for example, the call to the Lawson services Data, Drill, or Transaction. Typically, this includes the protocol, host, port, and the path to the data. |
timeout | int |
Optional. This parameter sets the time out value in milliseconds for POST and GET requests. Use "null" if you are not specifying this parameter. |
executePostMethod() parameters
The executePostMethod() takes the parameters shown in the following tables. In each set of parameters, the timeout parameter is opitional. If it is not specified, it is assumed to be 0. The executePostMethod() method returns a ResponseObject.
executePostMethod(url, data, timeout)
Parameter | Type | What it contains |
---|---|---|
url | String | The URL that contains the data you want to access. This is, for example, the call to the Lawson services Data, Drill, or Transaction. Typically, this includes the protocol, host, port, and the path to the data. |
data | InputStream | An InputStream object that contains the form data to be posted. |
timeout | int | Optional. This parameter sets the time out value in milliseconds for POST and GET requests. |
executePostMethod(url, data, contentType, timeout)
Parameter | Type | What it contains |
---|---|---|
url | String | The URL that contains the data you want to access. This is, for example, the call to the Lawson services Data, Drill, or Transaction. Typically, this includes the protocol, host, port, and the path to the data. |
data | InputStream | An InputStream object that contains the form data to be posted. |
contentType | String | A text string indicating the type of content, such as text/xml or text/html. |
timeout | int | Optional. This parameter sets the time out value in milliseconds for POST and GET requests. |
executePostMethod(url, data, timeout)
Parameter | Type | What it contains |
---|---|---|
url | String | The URL that contains the data you want to access. This is, for example, the call to the Lawson services Data, Drill, or Transaction. Typically, this includes the protocol, host, port, and the path to the data. |
data | String | A text string that contains the form data to be posted. |
timeout | int | Optional. This parameter sets the time out value in milliseconds for POST and GET requests. |
executePostMethod(url, data, contentType, timeout)
Parameter | Type | What it contains |
---|---|---|
url | String | The URL that contains the data you want to access. This is, for example, the call to the Lawson services Data, Drill, or Transaction. Typically, this includes the protocol, host, port, and the path to the data. |
data | String | A text string that contains the form data to be posted. |
contentType | String | A text string indicating the type of content, such as text/xml or text/html. |
timeout | int | Optional. This parameter sets the time out value in milliseconds for POST and GET requests. |
Response object methods
Following is some detail on the methods mostly commonly used with the response object.
Method | What it does |
---|---|
getResponseBodyasString() |
Returns the response as a String. This is typically used if a text-only response is expected. The returned String can be parsed to locate only the required information. |
getResponseBodyasStream() | Returns the response as an InputStream. |
getStatus() | This method returns the HTTP status of the call. Typically, a status of 200 indicates success. |