HTTP Scenario Pack configuration consists of:
-
Scenario Simulator Command script file
-
HTTP Scenario Pack configuration properties
-
XML schema configuration files
Scenario Simulator Command Script File
Scenario Simulator Command Script Files by default can be found under location: <scenario_simulator>/http-examples/config/*.commands
.
There are scripts for client and server setup with and without TLS support. These files contains scenario simulator commands. Usage of a commands script file is recommended but not required as it is possible to run all the required commands manually from the simulator prompt.
Below is the content of the setup-client.commands script file:
set-endpoint-address client client.opencloud.co.nz:9999
create-local-endpoint client http
bind-role client client
set-endpoint-address server server.opencloud.co.nz:8080
bind-role server server
The first set-endpoint-address
command sets the address of "client" to client.opencloud.co.nz:9999
.
The second set-endpoint-address
commands sets the address of "server" to server server.opencloud.co.nz:8080
.
Command bind-role
binds the client endpoint address to scenario role client and server endpoint address to scenario role server
HTTP Scenario Pack configuration properties
Below are properties for configuring the HTTP Scenario Pack, including properties for secure configuration:
Configuration properties
Name | Type | Default | Description |
---|---|---|---|
IsClient |
Boolean |
true |
Specifies whether the protocol adaptor will act as an HTTP client. If set to true (default), then it allows outgoing connections and sending HTTP requests. |
IsServer |
Boolean |
true |
Specifies whether the protocol adaptor will act as an HTTP server. If set to true (default), then it will listen on for HTTP requests. |
MaxOutgoingConnections |
Integer |
20 |
The maximum number of outgoing TCP connections the protocol adaptor will open to a single host when sending requests to that host. |
MaxDepth |
Integer |
1 |
Controls how many HTTP requests may be queued up on a single connection without receiving a response from the server. This is known as "HTTP pipelining". |
ViaReceivedBy |
String |
null |
Value that will be used as Via received-by (according to RFC 2616 - section 14.45) when Via header field marked as AUTO in an HTTP scenario message. |
Secure configuration properties
Name | Type | Default | Description |
---|---|---|---|
SecureServer |
Boolean |
false |
Controls if the protocol adaptor will listen on for HTTPS requests. If set to true, then a KeyStore must be provided that contains the private key for the server. |
KeyStore |
String |
(empty) |
Path to JKS keystore file. |
KeyStorePassword |
String |
(empty) |
Keystore password for file specified by KeyStore. |
TrustStore |
String |
(empty) |
Path to JKS keystore for trust certificates. The special value |
TrustStorePassword |
String |
changeit |
Keystore password for file specified by TrustStore. |
CipherSuites |
String |
(empty) |
List of cipher suites to pass to SSLEngine.setEnabledCipherSuites(). An empty value means the method won’t be called and all cipher suites are enabled. |
SSLSessionTimeout |
Integer |
0 |
Value to pass to SSLContext.setSessionTimeout() after the context is created. A value of 0 means the method won’t be called. |
SecureOutgoingConnections |
String |
(empty) |
List of endpoint addresses (host_address[:port], where port is optional) to which all outgoing TCP connections opened by the protocol adaptor will be secure. |
XML Schema Configuration Files
Scenario Simulator supports loading of external XML schemas to extend the range of supported data types as part of given scenario protocol schema.
In order to use an external XML schema in the HTTP Scenario Pack the XML schema needs to be installed according to the installation instructions below.
1 |
Copy the XML schema file into directory |
---|---|
2 |
Configure the prefixes and xpaths mappings according to your needs in the configuration files: prefixes.cfg and xpaths.cfg located in directory |
For more details on how to configure the prefixes and xpaths mappings see the instructions below.
Prefix to namespace mapping configuration
Scenario Simulator provides a configuration of prefixes to target namespaces mappings. This configuration is used in order to assign unique prefixes to XML schema namespaces.
Prefixes are configured in the prefixes.cfg file located in directory <scenario_simulator>/protocols/http-xml-schemas/
. After being defined the prefixes can be used within configuration of xPath expressions for selection of XML elements from installed XML schemas. In addition, depending on given XML schema qualification of local elements and attributes, the configured prefixes will be used in generated instance documents or XML fragments in encoded HTTP messages. Otherwise, if there is no prefix configured for given target namespace, a unique prefix will be generated.
Prefixes to namespaces mappings should be given in format as follows:
prefix=namespace
Where:
prefix - is a valid prefix as defined in 'Namespaces in XML 1.0 (Third Edition) W3C Recommendation 8 December 2009'. namespace - is a valid namespace name of existing schema as defined in 'Namespaces in XML 1.0 (Third Edition) W3C Recommendation 8 December 2009'.
Example:
so=http://www.example.com/shiporder
Where 'so' is a prefix and 'http://www.example.com/shiporder' is the target namespace of the shiporder schema.
Note:
-
External XML schema file should follow 'XML Schema Part 0: Primer Second Edition W3C Recommendation 28 October 2004' under http://www.w3.org/TR/xmlschema-0/.
-
In case invalid schema file used or invalid mapping defined, when starting Scenario Simulator and Editor the error will be displayed describing the problem.
-
<scenario_simulator> is the directory of your local installation of the Scenario Simulator.
-
'Namespaces in XML 1.0 (Third Edition) W3C Recommendation 8 December 2009' document can be found under http://www.w3.org/TR/xml-names/.
Field name to XML element mapping configuration
Scenario Simulator provides a configuration of field names to XML elements mappings. This configuration is used in order to assign unique field names under which the pointed XML elements from the installed XML schemas will be accessible as HTTP Message-Body types in the Scenario Simulator and Editor. Fields names to XML elements mappings are configured in the xpaths.cfg file located in directory <scenario_simulator>/protocols/http-xml-schemas/xpaths.cfg. Field name to XML element mapping should be given in format as follows:
field_name[COLON charset *(COMMA charset)]=xpath_expression
Where:
field_name - is the name of the field representing XML element, used as HTTP Message-Body type. charset - is the optional character set, e.g. 'UTF-8'. If no charset is defined, then the default charset 'UTF-8' will be used. xpath_expression - is the XPath expression which should evaluate to a single XML element defined in the XML schema. In the expression as part of element path it is required to use prefixes declared in prefixes.cfg configuration file.
Example:
shiporder=/so:shiporder shiporder:UTF-8=/so:shiporder shiporder:UTF-8,windows-1250=/so:shiporder
Where prefix 'so' is defined in prefixes.cfg as 'so=http://www.example.com/shiporder'.
Note:
-
The field_name must be unique.
-
When more than one charset is declared, then a separate scenario field for each charset will be created representing the same XML element but having different underlying charset defined.
-
It is possible to define more than one field_name for the same XPath expression.
-
In case of incorrect mappings defined, e.g. duplicated prefixes configured or illegal field / charset name defined or invalid XPath expression used, when starting the Scenario Simulator and Editor the error will be displayed describing the problem.