Table of Contents

Search

  1. Preface
  2. Understanding Data Types and Field Properties
  3. Designing Processes
  4. Using and Displaying Data
  5. Designing Guides
  6. Designing Process Objects
  7. Designing Service Connectors
  8. Using Connectors
  9. System Services, Listeners and Connectors

2. Design

2. Design

Checking for HTTP Errors

Checking for HTTP Errors

When you send a request to a server and it cannot complete the request, it returns an error status code. There are two ways in which a service connector can handle HTTP errors (4xx and 5xx status code in the HTTP response).
  1. For each Action defined on the
    Actions
    tab, you can select Fail on HTTP error, as shown in the illustration below. By default, this option is enabled. If the HTTP request returns an HTTP error, the service connector fails.
  2. Specify how to handle the HTTP errors for each Action on the
    Output
    tab. To implement this option, disable Fail on HTTP error.

Fail on HTTP Error

If you enable Fail on HTTP error and an HTTP error is returned:
  • A process faults and you can view the process details in the
    Application Integration Console
    .
  • A process displays a dialog to the end user with message text showing the HTTP error received.
  • The service connector throws faults in the same format a process throws faults:
    <sf:faultResponse> <sf:code>CODE</sf:code> <sf:reason>REASON</sf:reason> <sf:details>DETAILS</sf:details> </sf:faultResponse>
HTTP error codes follow the format HTTP_NNN, for example, HTTP_404. The reason string contains the HTTP status message.
Any internal or system errors return SERVICE_CONNECTOR_ERROR and one of the following reason strings:
  • CATALOG_ERROR
  • OTHER_PARAMETERS_ERROR
  • AUTHENTICATION_ERROR
  • CUSTOM_HEADERS_ERROR
  • BINDING_URL_ERROR
  • ALTER_REQUEST_AUTHENTICATION_ERROR
  • PROCESS_RESPONSE_AUTHENTICATION_ERROR
  • OUTPUT_PARAMETERS_ERROR
If you disable Fail on HTTP Error and an HTTP error is returned:
  • A process does not fault and the service connector passes the 4xx or 5xx status codes to the process so that you can handle the error in the process.
  • A or process faults and displays a failure message.
If the target service uses error codes that users might encounter as a matter of course, enable this option to provide process users with meaningful information.
The following image shows the Fail on HTTP error option enabled:

Handle HTTP Errors

To handle HTTP errors for a process, first be sure that you have disabled
Fail on HTTP error
.
You then need to check the HTTP response status code within the process.
To do this, define an "HTTP Response Status Code" as a variable in the
Output
tab. You can also specify a variable using $ResponseStatusCode in
Expression
fields (see the available functions below). In this way, you can pass the status code as part of the service connector's output and handle the response in the process.
These variables, like all variables you create in the
Output
tab, display when you click
Test
.
If you check Fail on HTTP error and an HTTP error status code is returned, the output contains a message.

HTTP Response Header Information Using
Expression

You can use one of the following to get details from the response headers:
$ResponseHeaders[@
name
= "Content-Type"]/text();
This constant contains the HTTP response header.
fn:getResponseHeader( $ResponseHeaders,
header_name
[,
default_value
] );
Returns a response header value. If the header parameter is not defined, this function returns the optional default value.
fn:responseHeaderExists( $ResponseHeaders,
header_name
);
Returns a Boolean value that indicates if a header parameter exists within the response.
fn:getResponseHeaderNames( $ResponseHeaders );
Returns a list that contains the names of all the parameters within a response header.