Creating a New Service (Service Virtualization)

There are two ways of creating a new virtual service.

  • Recording a Service
  • Adding a Service Manually

This section covers recording of HTTP based service. Most of these steps are common for all protocols. For other protocol specifics, refer to protocol specific recording guide.

Recording a Service

How to record a service, service virtualization, and tracing

Here we have mentioned the pre-requisites and steps for recording a new service.

Prerequisites

  • Web service is an existing service and is available for recording.
  • Application is configured to interact with back-end services at controller service end point IP address and the port to be used for recording.
  • There are no fire wall restrictions between Application and Controller and Controller and Backend servers to be used for recording.
  • There are no other processes in appliance using the IP/port to be used by recorder.

Following diagram displays the setup for recording a service:

  • NetOcean Recorder: It is a process by which request and response are recorded.
  • Service Repository: It is directory or repository, which contains all the virtualized services

Recording Configurations

Before recording service, you need to perform some configurations based on the recording mode. Follow the below-mentioned steps for recording configurations:

  1. On the Services menu, click the Record menu item.

2. The Service Recording window is displayed with following recording modes – HTTP Recording, JDBC Recording, and Socket Recording.

Note: When you try to record a service/page, and if the recorder is already running in the background, a pop up dialog box with a message is displayed – “Recorder is already running. Do you want to stop the recorder and start recording”. You can stop the recorder from there and start a new recording.

In the subsequent sections, recording configurations of each recording mode is described. Let’s start with HTTP Recording first.

HTTP Recording Configurations

In the Recording Type section, there are two options for recording: Web Service Recording and Webpage Recording.

Web Service Recording Configurations

Provide the following details:

  • Recording Name: Name of the recording for reference purpose. The user is required to provide the recording name that work as a prefix while creating a service through recording. Example: Recorded Service name: ‘shoppingCart’ Prefix by user: ‘cavisson_’ Service name added in record: ‘cavisson_shoppingCart’.
  • Recording Port: Port on which incoming request comes. Here, a dropdown list is provided for recording port. Either user may provide own recording port or select some port from the provided dropdown list.
  • Request URL Filter: This is used to specify URL filter if user needs to send different URLs on same recorder port to different backend servers. In most cases, it is.* to indicate all URLs.
  • Protocol: This is used to specify protocol of recording weather it is HTTP or HTTPS.
  • Endpoint Hostname or IP: Hostname or IP address of the backend server or endpoint server is the server from where the response is captured to NetOcean.
  • Service Endpoint Port: Port number of the backend server port on which the application is running.
  • Client Certificate: A Client certificate is a variant of a digital certificate that is widely used by the client to make the systems authenticated so that trusted requests should go to a remote server. This certificate plays a crucial role in several joined authentication design, which offers a well-built guarantee of a requester’s identity.
  • Endpoint Certificate: Endpoint certificate are very small data files that digitally combine or join a cryptographic key to the company’s details and information. When SSL is installed on a web server, it triggers the security device and the https protocol (over port 443) allowing locked and safe connections from a web server to a browser

Note: At the time of service recording, the user can use all the special characters (in service endpoint host name) except Hash (#) and space as these are special type of characters used in URI and it can only be read by client (browser). The server cannot use # in URI.

Web Page Recording Configurations


Provide the following details:

  • Recording Name: Name of the recording for reference purpose.
  • Recording Port: Port on which incoming request comes. Here, a dropdown list is provided for recording port. Either user may provide own recording port or select some port from the provided dropdown list.
  • Request URL Filter: This is used to specify URL filter if user needs to send different URLs on same recorder port to different backend servers. In most cases, it is.* to indicate all URLs.

JDBC Recording Configurations

Java Database Connectivity (JDBC) is an application-programming interface (API) for the programming language Java, which defines how a client may access a database. It is a Java-based data access technology used for Java database connectivity. The user can perform JDBC recording and can virtualize the database services

Provide the following details:

  • Connection ID: Database Name
  • JDBC Driver: It is a software component enabling a Java application to interact with a database.
  • Connection String: IP/Port
  • Login Credentials: Username and Password

Socket Recording Configurations

You can record the generic data coming on TCP socket as configured and send it to the server. To record generic TCP services in NetOcean, a recorder is created which acts as a proxy.

Provide the following details:

Name: Provide the recording name. It is used to provide the prefix for the service name, It has the same functionality like in the previous recordings. Example: If you provide any Recording name Demo, all the service name with respect to this configuration is saved as Demo_ServiceName.

Port: The port on which you want to record. This displays the list of defined port range. You can select any port from the list, or mention any port manually which any other processes are not using.

Protocol: Select the protocol from the list. It can be either SSL (secure) or NON-SSL (non-secure).

Note: You can enter a custom port while creating recorded services. If you keep it blank, the default endpoint port is fetched. Default SSL port is 443 and Non-SSL port is 80.

Service Endpoint Hostname/IP: Configure the service endpoint host name and IP.

Service Endpoint Port: Enter the Service Endpoint Port. For now, SSL port is 443 and Non SSL port is 80, but you can specify this port according to configuration.

SSL Settings: This option ( ) is enabled only if you select the SSL protocol. You can upload the certificate (client certificate and endpoint certificate) by clicking the  button.

Advanced Settings: You can configure the advance settings for the TCP. The advance settings can be done for request and response both. On clicking the  button, the Advance Settings window is displayed.

Provide the following details:

End Point Policy: You can configure the following End Point Policy in the TCP Recording:

  • TCP Segment
    • Reading of data is stopped after reading 1 segment (reading once).
  • Request Length
    • Reading of data is stopped if read complete bytes as provided.
  • Request Delimiter
    • Reading of data is stopped if a suffix message is found.
    • Max Delimiter length can be 64 bytes.
  • Dynamic Request Length
    • Dynamic length is to be provided by you in the message prefix.
    • Prefix type can be text or binary.
    • For text type, prefix length can be 1 to 20 bytes.
    • For binary type, prefix length can be 1,2,4,8 bytes.
    • L/B is for little endian or big endian. Default is little endian. It is only used when prefix type is binary.
  • Timeout
    • Reading of data is stopped if some of the bytes has been read and no activity until idle and max timeout has expired.
  • Message Contains
    • Read till message contains <contain value>
    • Contain value length can be 1 to 64 bytes.
  • Connection Closed
    • Reading of data is stopped if connection is closed.
    • This is applicable in recording only (not in Socket service). Hence, while creating services in NetOcean this end policy will be replaced with default end policy (i.e. TCP segment)

Timeout Settings (ms):  Provide the values for the following timeout options:

  • First Byte Receive Timeout
    • It waits for the first request.
    • Connection is closed if this timeout occurs.
  • Idle Timeout
    • It is a delay between two conjugative reads.
    • It resets on every read.
    • Connection is closed if end policy is not timeout and timeout occurs else process data and start reading again.
  • Max Receive Timeout
    • It is max read timeout.
    • It resets on every read.
    • Connection is closed if end policy is not timeout and timeout occurs else process data and start reading again

 Decode Settings: There are following decode types:

  • Plain Text
  • Hex
  • Base64
  • Binary

Note:

  • The policy and timeout settings are available for both request and response. To have the same policy and settings at response end, select the Same As Request check box.
  • Once you are done with advance setting, you can save this configuration in UI. This is displayed in tabular format.
  • You can provide multiple configurations for different recording name, host name, and port.

You can perform the following options from UI:

  • Delete Configuration: You can delete the configuration also.
  • View Configuration: You can view the configuration by clicking the info icon. This displays the advance setting window and all the information is displayed.

Once the recording configurations are done, you can record a service. In the subsequent sections, the recording with each recording mode is described.

HTTP Recording

Web Service Recording

  1. Select Web Service Recording option from the Recording Type drop down.
  2. Provide the required details, such as recording name, recording port, protocols, service endpoint hostname/IP, service endpoint port, client certificate (optional), and endpoint certificate (optional) and click Add.
  3. Click the Start Recording button to start the recording.

4. Click OK. The following window is displayed where recorded requests and response requests are displayed as ‘0’ initially.

5. Open the URL in the browser, which is mentioned in the recording screen

6. Browse your web application for example: www.google.com, and wait until the page is fully loaded. Navigate few pages there.

7. Once the requests and response are being captured, its count is displayed accordingly along with the details of captured URLs their request payload and response payload.

8. To stop recording of the service, come back to the NetOcean – Service Recording window and click the Stop Recording button.

9. After the user clicks the Stop Recording button, Request and Response of every URL are displayed as in the snapshot. The service and template names for each URL are assigned automatically, which can also be edited by the user.

After creating a service through recording, all the respective headers, status code are configured in the service level and template level as well. It takes less time to configure all the headers, which are captured through recording.

The user can either configure or not-Configure service-time during recording by using the “Enable Service Time” check box.

10. Likewise, request and response can be recorded for other URLs too.

11. To create the service, select the check box for the particular URL and click on Create Service(s) or Create Service(s) and Activate button.

12. If the service already exists, the following window is displayed.

For any Service, which is already simulated in NetOcean, the user can create services according to their needs after recording the application URL. This avoids addition of templates into existing service with same URL.

Options available for the user:

  • Delete the Existing Services and create new Recorded Services
  • Disable the Existing Services and create new Recorded Services
  • Create Backup (Disabled Mode) and Delete Existing Services and create new Recorded Services
  • Create the template in the Existing Services

13. Once, user clicks the Create Service(s) button, service gets added and is displayed in the list of services as displayed in the snapshot.

14. Now, the user can get a response for this particular URL.

Web Page Recording

  1. Select Web Page Recording option from the Recording Type drop down.
  2. Provide the required details, such as recording name, recording port and click Add.
  3. Click the Start Recording button to start the recording.

  1. Import the certificate file. (Get it from your Cavisson representative).
  2. Open browser and enable proxy. Use the IP and port for proxy servers for all protocols as mentioned in the below window.
  3. Browse your application and wait until page is fully loaded.
  4. The captured request and response count is displayed along with captured URLs, request payload and response payload.

8. After the user clicks the Stop Recording button, Request and Response of every URL are displayed as in the snapshot. The service and template names for each URL are assigned automatically, which can also be edited by the user.

After creating a service through recording, all the respective headers, status code are configured in the service level and template level as well. It takes less time to configure all the headers, which are captured through recording.

The user can either configure or not-Configure service-time during recording by using the “Enable Service Time” check box.

9. To create the service, select the check box for the particular URL and click on Create Service(s) or Create Service(s) and Activate button.

10. Click Proceed. The captured web page recording is displayed on the Manage Services window.

Note: ‘Host’ column displays the host name mentioned at the time of recording.

JDBC Recording

  1. Once the JDBC recording configurations are done, click the Start Recording Here, the example is for recording a sample application – nsecom.

Note: For nsecom application URL, kindly connect with Cavisson representative from Client Support team.

  1. In the Browser, provide the hostIP and port and then nsecom.

Example: 10.10.40.18:8003/nsecom

  1. Go to Home-Page, then place the order completely for complete recording.

Page – 1

Page – 2

Page – 3

Page – 4

  1. Stop the recording and provide the service name.

  1. After you click the Stop Recording button, the Request and Response of every URL are displayed as in the snapshot. The service and template names for each URL are assigned automatically, which can also be edited.

  1. Click the ‘Create Service(s)’ button. This creates the service.

Socket Recording

  1. Once the configurations are done, click the Start Recording button to start the recording.

Note:

  • Setup the TCP Client to record the services.
  • UI displays the count for the request and response.
  • The recorded request and response are displayed in the UI.
  • You can see the individual request and response for the all recorded request and response.
  1. Stop Recording: Once you are done with the recording, stop the recording.

  1. Captured Request Response List: After stopping the recording, request and response list is displayed on the UI. All the recorded information is displayed on the UI.

You can see the following recorded information on UI.

  • Recording name: Recording name is displayed as provided at the configuration time.
  • Port: Port name as configured.
  • Service name: You can see the service name of each recorded request; accordingly it is displayed on the UI. It is a combination of Recordingname_Socket_port_randomVal.
  • Templates: All the templates are displayed as template1 by default.
  1. Create Services: You can create the services for the selected records,

Following conditions are displayed according to the port used in the recording.

If recorded host is captured on the same port, which is already used by the existing services, then you need to select the following option:

  • Create a template in the existing service on the same port
  • Delete the existing service and create with new recorded services
  • Disable the existing service and create with the new recorded services
  • Take backup of existing services and create a new services
  1. Create and Activate Services: You can create and activate services. Once you create the service, NetOcean server also starts.
  2. Manage Services: All the services list is displayed in Manage Services page.

Adding a Service

User can add a service manually for an existing service or a new web service.

There are four ways for adding a service:

  • Normal Mode
  • RTC Mode
  • WSDL
  • Swagger

Adding a Service Manually (Normal Mode & RTC Mode)

In this mode, the user can add an HTTP service and a Generic Socket type service.

  1. On the Services menu, click the Add menu item. In normal mode, user would need to activate the HPD (by clicking the  icon) to reflect the changes every time. However, in case of RTC mode, there is no need to restart the HPD. It reflects the changes at run time.
  2. Select any of the two options; the NetOcean Add Service Window is displayed.
Service Type – HTTP(s)

3. Enter following fields to add the service as displayed below:

  • Service Name: Unique name of the service
  • URL: URL of the service
  • Regular Expression: it allows use of regular expression in URL so that if some pattern changes in request and remaining URL is same then NetOcean responses for this request.
    • Ignore Case: It is used to ignore case in URL.
    • Complete Match: It is used to match complete URL.
  • Template Name: Template name of the first template. If user needs more templates, he/she can add after service is created.
  • Sample Request: Sample request of the service. This is used for testing and for defining Request Parameters. User can select a file where sample request is stored by clicking the Choose button.
  • Response Template: Response of this service for this template. User can parameterize it later using different types of parameters. User can select a file where sample response is stored by clicking the Choose button.
  • Response Content Type: Select the response content type if applicable. Response content type is used to put in header in response. The Content Type property of header specifies the HTTP content type for the response. If no Content Type is specified, the default is text/HTML.

There is an option ‘View in Browser’ to view requests / responses in the browser window with Response Content Type as html, xml, and json.

Example – Viewing Request / Response in Browser

4. Click on Add  button. The service is added and NetOcean services window is displayed.

Smart Editor

NetOcean has certain text areas where the users get long xml, JSON, etc. The content is not formatted in most of the cases which leads to the need for a Smart Editor which adds color-codes and formatting to the content making it easier to read and analyze.

Features

  • Beautification/formatting of ugly/minified XML, JSON, HTML, CSS, JavaScript.
  • Addition of color-codes in XML, JSON, HTML, CSS, JavaScript. This feature displays content in different colors according to the category of terms. This feature facilitates writing in a structured language such as markup languages both structures and syntax errors are visually distinct. Highlighting does not affect the meaning of the text itself; it is intended only for human readers.
  • Auto-Closing of tags in XML/HTML when opening tag is completed with intelligent handling for singular/Unpaired tags
  • Code-Folding to collapse (hide) and expand parts of a file, making it easier to focus just on the parts of interest.
  • Highlight matching Tag in XML, HTML that highlights the corresponding matching tag.
  • Highlight matching bracket (like round brackets, square brackets, box brackets) at current cursor position.
  • Placeholder display in case of blank content in editor. 

Functionality

  1. To add color-codes to the content, select the specific content type from the drop-down:

2. After selecting the content-type, color-codes is added as follows:

Formatting Content

3. To format the content for a specific type, select/highlight the content in editor as follows:

4. Click the beautify icon () which formats the content as follows:

Generic Socket Type Service

Apart from HTTP(s) service, the user can also virtualize generic socket services. A support is provided for services, which can respond to generic data coming on a TCP socket configured by the user.

  1. Go to the Add Service window and select the Service Type as Generic Socket.

2. Provide the service information:

    • Service Name: Name of the generic socket service.
    • SSL Port(s): HTTP port(s)
    • Non-SSL Port(s): HTTPs port(s)
    • Template Name: Name of the template
    • Communication Type: Select TCP as communication type.

3. Select the sample request, response, and click Add.

4. The service is added and displayed within the Services section of the NetOcean Manage Services window.

Addition of a Service with Binary Payload

The user can also upload binary data for request/response payload of HTTP / TCP services in the ‘Add Service’ window.

  1. Go to the Add Service window.

2. Fill out the other details of the service to be added.

3. If the file to be used as payload is a text file (Content type: “text/*” or “application/json”), click the Choose button and select the respective file. In such a case, the contents of a file is displayed on the respective request / response editor so that the user can modify the contents of editor according to the need.

Note: If the payload is a binary, then click on Choose button and upload the file. After upload, the respective request / response editor is set as read-only. Finally, click the Add button to add the service.

Note: The binary and text files are distinguished based on Content-type given by the operating system during upload. Therefore, the files with content-type as “text/*” and “application/json” are only treated as a text file and displayed on the editor for any modifications. In all other cases, the payload is directly uploaded and configured during the addition of service.

Adding a Service – Using WSDL

NetOcean provides a feature through which all client services, which are exposed through WSDL, can be imported in NetOcean. User need not to create the services manually, writing the requests, response in NetOcean. User will get all the exposed Services / Operations in drop down and can select the Service / Operations from there, which needs to be migrated.

WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint. Related concrete endpoints are combined into abstract endpoints (services).

WSDL is often used in combination with SOAP and XML Schema to provide web services over the Internet. A client program connecting to a web service can read the WSDL to determine what functions are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema. The client can then use SOAP to actually call one of the functions listed in the WSDL.

Steps to Add a Service using WSDL
  1. On the Services menu, go to Add and click the WSDL option. This displays the WSDL Service Configuration window.

2. Provide the Service name and template name.

3. Specify the URL of Swagger file. For example: http://www.dneonline.com/calculator.asmx?wsdl

4. Click the Fetch Service Configurations button. This fetches the configuration of the WSDL file.

Note: User can either import service through drop-down list or specify the request / response in the text area and add service.

5. Fetch Service provides all the services, which are available to Client and all operations associated with that service. Select the service from the list and the operation corresponding to the service.

6. This automatically fills the endpoint URL. User will get the response from original Services, which is exposed by Client and NetOcean is ready to import that service in NetOcean.

7. Click the Add Service button. The service is added successfully.

8. This adds the service in the Services list.

Note: A user cannot save a WSDL service with a name that already exists. While doing so, an error message “Service Name is already there. Please assign other name” is displayed.

Adding a Service – Using Swagger

NetOcean provides a feature through which all client services, which are exposed through Swagger, can be imported in NetOcean. User need not to create the services manually, writing the requests, response in NetOcean. User will get all the exposed Services / Operations in drop down and can select the Service / Operations from there, which needs to be migrated.

Swagger is an open-source software framework backed by a large ecosystem of tools that helps developers design, build, document, and consume RESTful Web Services. While most users identify Swagger by the Swagger UI tool, the Swagger toolset includes support for automated documentation, code generation, and test-case generation.

User needs to provide the JSON URL through which all the services can be exposed and added in NetOcean.

Steps to Add a Service using Swagger

  1. On the Services menu, go to Add and click the Swagger option. This displays the NetOcean Swagger Configurations window.

2. Provide the Service name and template name.

3. Specify the URL of a Swagger file.

For example: http://petstore.swagger.io/v2/swagger.json

4. Click the Fetch Service Configurations button. This fetches the configuration of the Swagger file.

Note: User can either import service through drop-down list or specify the request / response in the text area and add service.

5. Fetch Service provides all the services, which are available to Client and all operations associated with that service. Select the service from the list and the operations corresponding to the service.

6. If any request needs mandatory parameter then a pop-up appears and prompts for that mandatory field, then it hits the Actual services, get the response from there, and is ready to save in NetOcean state.

7. It automatically fills the endpoint URL. User will get the response from original Services, which is exposed by Client and NetOcean is ready to import that service in NetOcean.

8. Click the Add Service button. The service is added successfully.

9. This adds the service in the Services list.

PinPad Services

PinPad services are used to serve the requests of PinPad devices. A PIN pad or PIN entry device is an electronic device used in a debit, credit, or smart card-based transaction to accept and encrypt the cardholder’s personal identification number (PIN), for example – an ATM machine.

Features

  1. These services are non-HTTP based services. PinPad services are created in the same way as normal services are created. The difference is, these services starts with /pinpad/ followed by function name. For example: /pinpad/function_name.
  2. Following features are removed from PinPad services which exists in HTTP based services:
    1. HTTP Setting
    2. HTTP Header
    3. Call Back
    4. Template Based Header
    5. Content Type
    6. HTTP Status Code
    7. Template Mode

PinPad Services

Edit Service – Templates

Normal Mode

RTC Mode

Example

Highlighted ones are command and function type coming in request:

1req:

Decrypt:

<ETRANSACTION><MAC_LABEL>P_832</MAC_LABEL><PAYLOAD>QZYjfY+cXOT3WZuU0W9U9QQRI9+cjNUXx4wyabF4qK8h3RNYyYUUHaZzUSfor9HwskzruFi6/LIm/oUmyMbjj/f+4wgtM2oNNz3yDrZr/1B6c9oUic8NaaRT7sR+qJcAUPDgMTr+huHVh/TtR3qwLbONAqO+DfBGMHQEgGkEuFBjZxBGRh1SOfNn7YtH+KXrH3tgG2+hG8fjGFCNTMgdFFJxWMOGtxekjt7DBkUMv3vGcDro6mveLtxoYpitDYozyyDZg50XzPU6iMAxyi3fqw==</PAYLOAD></ETRANSACTION>

Encrypt:

<TRANSACTION><FUNCTION_TYPE>SECURITY</FUNCTION_TYPE><COMMAND>TEST_MAC</COMMAND><MAC_LABEL>P_832</MAC_LABEL><COUNTER>1</COUNTER><MAC>tKFNGARwCJza8hIN6q0bUMvh+we9I11muO8hmCSVW1U=</MAC></TRANSACTION>

1resp:

Encrypt:

<?xml version="1.0"?>

<ERESPONSE><PAYLOAD>DRN0CLZ/s4SIMV1NRR3ItEvRXWUzKUQjwUlod3QlTZ5lI6tTBj5vD9kV5EhPgKQdXTGrSuD0kLkbj6wgU+6HG+aBtQOUFG+cULs8vwmR92wg/GJGT2eFoLi20hl1qmbqg7xofNhKgiGVX1iTMbcSZOf/dPks+83F5vmaf7+NOZpGzqxBlG7hKD+tI1ipi8yAsdmhUXrQi34L2+RpUe5cQeK3y8qTSkZODqhlGI+KzzadDkG3pi2xijK4Rbk8SfnhBJ0Lj74duNp/k6icK3c2jg==</PAYLOAD><MAC_LABEL>P_832</MAC_LABEL></ERESPONSE>

Decrypt:

<?xml version="1.0"?>

<RESPONSE><RESPONSE_TEXT>Match</RESPONSE_TEXT><RESULT>OK</RESULT><RESULT_CODE>-1</RESULT_CODE><TERMINATION_STATUS>SUCCESS</TERMINATION_STATUS><COUNTER>1</COUNTER></RESPONSE>