Manage Services Using Service Settings

This section is to define all settings related to services used in NetOcean.

Click Service Settings tab on the left upper pane. The following settings are available:

  • HTTP Setting
  • HTTP Header
  • TCP Settings
  • Service Time Delay
  • Trace Level
  • Comment
  • Call Back
  • Forward Settings

HTTP Setting

This allows users to use HTTP settings, such as keep alive time and decode request content settings. It also provides provision to configure mock response details, content length indicator, and date header.

HTTP Settings Details

  • Decode Payload Content: HTTP settings have decoded request content and keep alive timeout, decode content settings is useful if request is coming in encoded format (URL encoded). If decoding is enabled, request is decoded so that request parameter value is populated with the decoded value (not encoded one). In addition, user can use decoded value in Prefix and Suffix in the Request parameter definition.
  • Keep Alive Timeout: Keep Alive timeout is useful when user needs to use connection timeout for service. Here it is defined in seconds.
  • Compression Type: A user can compress the response by using compression types – Deflate, Gzip, and BR. Select any compression type to apply. Selected compression type format is displayed under the Response Template.

This is described within “Content Encoding: Compression of Response Files” section.

Mock Response Details: In mock response section, user can configure the percentage of the selected HTTP Status code to be reflected in the response of the service.

Content Length Indicator: Content Length Indicator allows a user to transfer data into a series of overlapping chunks. Once the user selects the Enable Content Length Indicator checkbox, more options are displayed in the below format.

The user can choose from two options in the Chunk Scheme drop-down: Size of chunk and Number of chunks.

The checkbox for Default size of chunk / Default number of chunks is selected by default. The user must clear the checkbox to enter a value other than the default value.

The default size of a chunk is 1440 bytes and the default number of chunks is 2.

Date Header: Date header is used to display the current date and time in the response template. Once user enables this check box, the current date and time is appended in the response.

  1. Click Manage button () on the top panel. Select the specific service on which enable date header is applied and click Test at the bottom of the screen.

2. This displays a Test Service screen, click Test. It opens the response template of the service with the applied date and time.

This is described within “Date Header in Response” section.

HTTP Headers

NetOcean sends following headers in the service response:

  • Content-Length
  • Content-Type – If content type was select for the template.
  • Any additional header specified in global header files
  • Any header added using C API used in the Callback methods

Using HTTP header setting, user can send additional HTTP headers in the response for the service.

Steps to add HTTP headers

  1. Go to Service Settings > HTTP Header link on the left pane. HTTP Header window is displayed.


    • ‘Template Based Headers’ has higher priority than ‘Service Based Headers’.(Example:- ‘Service Based Headers’ will be overridden if ‘Template Based Headers’ is defined in that Service.)
    • Template based ‘Content type header’ has higher priority than Service based ‘Content type header’.(Example:- Service based ‘Content type header’ will be overridden if Template based ‘Content type header’ is defined in that service.)
  1. Enter the header name. Click the Add button to add the header.

TCP Settings

This is applicable for TCP type services. This allows you to use TCP settings, such as to request decode type, first request timeout, keep-alive timeout, and request end policy.

  • Request Decode Type: If decode mode is provided then the data will be converted from binary to the provided decode mode. If no decoding mode is provided then, default decoding will be done in Text format. Decode modes can be NA (plain text), Hexadecimal, Binary, or Base64.
  • First Request Timeout: The receive action stops when no bytes are received from the connection after timeout defined. If the timeout value will not be provided then, then the default timeout is applicable.
  • Keep-Alive Timeout: This option is used to set the Keep-Alive Timeout.
  • Request End Policy
    • Request Segment: Reading of request data will be stopped after reading once.
    • Request Length: The user will provide a fixed request length, which will tell the end of the request. The receive action stops when the provided number of bytes is received.
    • Request Delimiter: If request end delimiter is provided then consider the end of request after receiving that delimiter.
    • Dynamic Request Length: If request length is provided at the starting of request then read that much length. The format also has to be given. It can be integer or text. If it is binary then it will be the in-network format.
    • Timeout: The receive action stops when the total read time for the socket will exceed the request timeout specified in the keyword. The default value of the request timeout has to be decided.
    • Message Contains: It reads the data until the Message contains in request/response data.
    • Connection Closed: If the connection is closed from Client side or server-side then the connection will be closed.

Service Time Delay

NetOcean sends a response to the service as soon as the request is received. So there is no delay in the Response. User can add service time delay by using Service Time Delay settings.

Service time delay settings have following options:

  • Enable Service Time: Select this check box to enable service time and proceed further.
  • No service time: No service time used.
  • Exponential Random service time: For exponential random distribution, median is roughly around ¼th of mean.
  • Constant service time: This property is used to provide constant service time.
  • Random (Uniform distribution) service time: This property is used for uniform distributions service time.

Trace Level

NetOcean logs important messages. These logs are called traces.

  • Disabled: No logs.
  • Log URL and Parameter: Request arrival time, URL, client IP, port, request file, service time, template name, response file, response time.
  • Log URL, Parameter, and Request/Response: Level 1 + parameters names and their values applied to that service


Using Comments, user can add comments to the service for his/her own reference. For example, design notes, modifications – any user-defined comments.


User can use Service Callbacks to add his/her own custom scripts using C language based callback methods. There are two types of callbacks:

  • Use On Request Method: This method is called on receiving the service request and after all search and conditional parameters are processed and before applying service delay time.
  • Use After Request Method: This method is called just before sending the response of the service.
  • Use External Library: Select this check box and then either select library from the drop-down list or upload it from system.

Following is the template of On Request callback method user can use:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include "/var/www/hpd/include/hpd_log.h"
#include "/var/www/hpd/include/hpd_string_api.h"
#include <errno.h>
#include <unistd.h>


Name: MyService_on_request_callback
Purpose: This method is called on receiving the service request and after all search and conditional parameters are processed and before applying service delay time.
Input:   None
Return:  The function controls service time. Return values can be:
0 - No service delay time. Override service delay time configure if any
-1 - Use service delay time as configured
>0 - Use service delay time in milli-seconds returned by this method

int MyService_on_request_callback()
return -1;

Following is the template of on request callback method:

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include "/var/www/hpd/include/hpd_log.h"
#include "/var/www/hpd/include/hpd_string_api.h"
#include <errno.h>
#include <unistd.h>


Name: MyService_after_request_callback
Purpose: This method is called on just before sending the response of the service.
Input:   None
Return:  None

void MyService_after_request_callback()

Forward Settings

Using this feature, you can provide forward settings to service level as well. These settings include – Forward Request Header, SSL Settings, and General Settings.

Forward Request Header: You can provide the Request Header in the forward Mode. There are following options:

  • Mode: There are three modes available for the Forward Request Header – Add, Modify, Delete
  • Header and Values: You can provide the header and values for the Request header.

Example: Content-Type:json


  • If you select the delete option in Mode, you do not need to provide the header values.
  • You can delete a header by clicking the

SSL Settings: You can provide the following SSL settings in this section:

  • TLS Version: You need to provide the TLS Version. Following options are available:
    • All version(s)
    • TLS 1.0
    • TLS 1.1
    • TLS 1.2
    • TLS 1.3
  • SSL Renegotiation: A number of Internet connections require SSL renegotiation, a Secure Sockets Layer/Transport Layer Security process that allows the changing of the details of a handshake after a connection is made with the server. There is a checkbox for the SSL Renegotiation, you can enable/disable it.
  • Cipher Suite: A cipher suite is a set of algorithms that help secure a network connection that uses Transport Layer Security (TLS) or its now-deprecated predecessor Secure Socket Layer (SSL). There is a list of cipher suite from where you can select the required ones.
  • Server Require Authentication for Client Certification: If you enable this check box, you need to provide the certificate.
    • Certificate File: The uploaded certificate file will be saved in the service directory.
    • Key File: On selecting the ‘Separate Key File Required’ checkbox, you need to upload the key file. The key file will also be saved in the service directory.

 General Settings: There are following general settings available in this section:

  • Forward Percentage: It is the % of request to be forwarded, the remaining will be served in simulated mode. The forward percentage should be in the range (0-100) up to 2 decimal places. Example: If you mention the percentage as 20%, then the remaining 80% will be served as a simulate mode.
  • Enable Service Time: In Forward mode, since the response is coming from the backend, there is no need to apply service time. However, in some cases, service time may be required and in that case, you can select the ‘Enable Service Time’ checkbox. Response time will the max of service time or the backend response time.


    • If the backend response time is 100 ms and the service time is 200 ms, the client request time will be 200 ms.
    • If the backend response time is 300 ms and the service time is 200 ms, the client request time will be 300 ms.
  • Replace/Add HOST Header in the Forward Request: If the host header is coming in the request, it will be replaced.
  • Connection Timeout: You can provide the connection timeout option at the template level also and it will be treated as a high priority.
  • Response Timeout: You can also provide the Response timeout at the template level.

Custom Headers Support in TIBCO JMS

A user can verify the functionality of TIBCO headers using call back API. A user can use various header types in API, for example, integer, Boolean, string, double, byte, float, long, and short.

For Example: ns_set_jms_hdr(“HEADER_NAME”,NS_TIBCO_INTEGER,  “HEADER_VALUE”)

The following steps are to be followed for custom headers support:

  1. Go to NetOcean Home Page.
  2. Click Services > Manage > Normal Mode.
  3. This displays the screen with all the services. Click on any service to apply custom headers.

4. On the next screen, click Service Settings > Call Back.

5. Apply the custom header (for example: values 1, 100 as in the image below) and click Save.

6. To verify, go to NetOcean home page > Request Trace > JMS Message. The header (as in example: values 1, 100) is consumed by the specific destination queue/topic.

7. Restart the NetOcean server.

8. Run test from NetStorm and verify it from server-side.