<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://www.xlayer.co.za/forum/extern.php?action=feed&amp;tid=61&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[SXI Forum / Install and Configure the new SXI Webservices]]></title>
		<link>https://www.xlayer.co.za/forum/viewtopic.php?id=61</link>
		<description><![CDATA[The most recent posts in Install and Configure the new SXI Webservices.]]></description>
		<lastBuildDate>Wed, 28 Nov 2018 18:04:31 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Install and Configure the new SXI Webservices]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?pid=98#p98</link>
			<description><![CDATA[<p>With v2.3 of the SXI Web services you get some additional functionality.&#160; SXIWebservices are distributed as a war file which can be downloaded from the SXI web server.</p><p>Below are some of the new features:</p><ol class="decimal"><li><p>Each web service has the ability of writing their transaction to a database</p></li><li><p>The tables will be created should they not exist</p></li><li><p>SXIWebServices makes use of Tomcat connection pooling</p></li><li><p>Any database that is supported by Tomcat can be used for SXIWebServices</p></li><li><p>SXI Rest Importer and SXI SOAP Importer can also now be called synchronously</p></li></ol><p>Some of the notable changes:</p><ol class="decimal"><li><p>The config names have been changed to remove the word Async (e.g REST Importer used to be called SXIRESTAsyncImporter.properties however it is now called SXIRESTImporter.properties</p></li><li><p>The REST importer and the SOAP importer each have their own log for both the Async and Sync endpoints - this can be changed if need be.</p></li><li><p>A common return object returned by all SXIWebServices</p></li><li><p>Several bug fixes and code cleanups</p></li></ol><h5><span class="bbu">Asynchronous Operation</span></h5><p>When a calling system calls the asynchronous endpoints the web services will immediately respond with a Transaction Response.&#160; This response will include the results of <strong>SAVING</strong> that transaction <strong>ONLY</strong>.&#160; The transaction IDs that are returned are only the <em>unique internal integration reference numbers</em> that have been generated for each transaction and are not an indication of a full / complete transaction.&#160; Asynchronous operations are typically called when integrating with systems like Service Desks.</p><h5><span class="bbu">Synchronous Operation</span></h5><p>A synchronous operation relies on writing to a database.&#160; The session will keep checking for a response that will be found in the &quot;tranResult&quot; field of specific transaction record that was inserted earlier.&#160; The session will wait for the number of seconds found in the <span style="color: blue"><em>DBSyncTimeout</em></span> configuration properties.&#160; </p><ul><li><p>If a response is found before the time out has expired the data inside the &quot;tranResult&quot; field is sent back to the calling system, as well as a <strong>SUCCESS transaction status</strong>.</p></li><li><p>If the Timeout value expires <em>before</em> the tranResult is found a <strong>FAILED</strong> status is returned to the calling system.</p></li></ul><h5><span class="bbu">Installation:</span></h5><p><em>Prerequisites:</em></p><ol class="decimal"><li><p><a href="https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html" rel="nofollow">Java</a>&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;- <em>v1.8_192 or above</em></p></li><li><p><a href="https://tomcat.apache.org/download-90.cgi" rel="nofollow">Tomcat</a>&#160; &#160; &#160; &#160; &#160; &#160;- <em>v9.0.13 or above</em></p></li><li><p><a href="https://www.microsoft.com/en-us/sql-server/sql-server-editions-express" rel="nofollow">MS SQLExpress</a> - <em> v2017 or above installed on your local server</em></p></li></ol><h5>Basic Steps</h5><ol class="decimal"><li><p>Download the SXIWebServices-2.3.war file from the SXI FTP server</p></li><li><p><strong>Rename</strong> SXIWebServices-2.3.war to SXIWebServices.war</p></li><li><p>Place the war file in the tomcat/webapps directory. <em>Tomcat will extract it for you.</em></p></li><li><p>Configure the relevant properties files</p></li><li><p>Each SXIWebService endpoint has 3 potential outputs:</p><ol class="alpha"><li><p>XML file on the file system</p></li><li><p>Database</p></li><li><p>Elastic Search (Big Data - typically for reporting)</p></li></ol></li><li><p>Configure the endpoints (<em>discussed below</em>)</p></li><li><p>Ensure the configuration that you are pointing to exists and can be accessed.</p></li><li><p>Restart Tomcat to activate the new configuration.</p></li></ol><h5>Configuration</h5><ol class="decimal"><li><p><strong>Configure transactions to be written to an XML File:</strong><br />To configure the SXIWebService endpoint to create an XML file on the file system, edit the .properties file corresponding to the endpoint you wish to use.&#160; These property files can be found in <em>[tomcat_dir]/webapps/SXIWebServices/WEB-INF/classes</em> directory.</p><ol class="alpha"><li><p>This functionality can be turned on by changing the <span style="color: blue"><em>CreateXML</em></span> property from <strong>No</strong> to <strong>Yes</strong>.</p></li><li><p>By default the <strong>Windows</strong> version of the <span style="color: blue"><em>XMLOutputPath</em></span> is active.&#160; Typically this is configured to point to the XPress XmlIn1, XmlIn2 or typically XmlOut directory.&#160; If SXIWebServices is installed on a *nix machine then simply comment out the Windows <span style="color: blue"><em>XMLOutputPath</em></span> property and un-comment the *Nix version and point the <span style="color: blue"><em>XMLOutputPath</em></span> to the directory you wish to have the transaction files written into.</p></li><li><p>Set the <span style="color: blue"><em>XMLEncoding</em></span> to either ISO-8859-1 / UTF-8.&#160; This determines what characterset is allowed to be placed into the XML output file.</p></li><li><p><span style="color: blue"><em>DefaultDestination</em></span> must contain the IP address or hostname of the server where XPressStation is listening for transactions to be processed.&#160; This can be left to 127.0.0.1 if you have configured <em>XMLOutputPath</em> to <strong>XmlOut</strong> - <em> For more details about using the XLayer Transport Module <strong>XPress</strong> please speak to your <a href="http://www.sxi.co.za" rel="nofollow">SXI</a> representative.</em></p></li></ol><p><span style="color: red"><strong>NOTE:</strong> You MUST have <strong><em>write</em></strong>&#160; permissions to access the directory configured in <em>XMLOutputPath</em> and the machine must have enough disk space to write those files.</span></p><p>If you have enabled Creating XML files your config should include a section that look as follows:</p><div class="codebox"><pre><code>#==============================================================================#
#Do you want the trigger to be created as an XML file: Yes/No
CreateXML=Yes
# Windows paths must use forward slashes.
XMLOutputPath = C:/SXI/XPress/XmlOut
#Unix
#XMLOutputPath = /opt/SXI/docstore/process
#This can be used to change the XML declaration (ISO-8859-1 / UTF-8)
XMLEncoding=ISO-8859-1
DefaultDestination = 127.0.0.1</code></pre></div></li><li><p><strong>Configure transactions to be written to a Database:</strong><br />There are 2 parts to this configuration:</p><ul><li><p>The properties file - <strong>Note:</strong> not all the properties are needed any longer as we have moved to connection pooling and the redundant properties will be removed in due course.</p></li><li><p>The Context.xml file used to configure <a href="https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html" rel="nofollow">Tomcat&#039;s Connection Pooling</a>.</p></li></ul><p>To turn on the functionality of writing the transactions to a database you need to change the <em>CreateDBRecord</em> property from <strong>No</strong> to <strong>Yes</strong>.</p><ol class="alpha"><li><p><strong>The Properties File:</strong></p><ol class="decimal"><li><p>This functionality can be turned on by changing the <span style="color: blue"><em>CreateDBRecord</em></span> property from <strong>No</strong> to <strong>Yes</strong>.&#160; <em>This will always be here</em></p></li><li><p><span style="color: blue"><em>DBType</em></span> refers to the type of database you are going to write the transactions into.&#160; In THIS example we will write transactions to a MSSQLExpress server that has been installed locally.&#160; </p><ul><li><p><span style="color: red"><strong>Note:</strong> you will need to download the jtds-1.3.1.jar file and copy it to the <em>[tomcat_dir]/lib</em> directory.</span>&#160; This jar file can be downloaded from the SXI FTP Server.</p></li><li><p>If you are wanting to write to a different database you will need to download the database driver jar file that is needed to communicate with that specific database type and copy it into the [tomcat_dir]/lib directory.&#160; There will also be further configuration to change in the Context.xml part.</p></li></ul></li><li><p>The <span style="color: blue"><em>DBServer</em></span> property refers to the IP address or hostname of the server where the database is installed.</p></li><li><p>The <span style="color: blue"><em>DBPort</em></span> property refers to the port the database is listening on.&#160; </p><ul><li><p><span style="color: red"><strong>Note:</strong> SQLExpress will <strong> NOT</strong> work unless you ensure that TCP is enabled and that the firewall is not blocking traffic on port 1433.</span>&#160; </p></li></ul><ul><li><p><a href="http://support.webecs.com/kb/a868/how-do-i-configure-sql-server-express-to-allow-remote-tcp-ip-connections-on-port-1433.aspx" rel="nofollow">Here is a web page explaining how to do this</a>.</p></li></ul></li><li><p><span style="color: blue"><em>DBUser</em></span> is a user that has suitable permissions to create a table and insert records into the <em>DBName</em> in the <em>DBTriggerTable</em>&#160; </p></li><li><p><span style="color: blue"><em>DBPass</em></span> is the password <em>in clear text</em> for the <em>DBUser</em>.</p></li><li><p><span style="color: blue"><em>DBName</em></span> is the name of the database where the Web Service Transactions will be written to. </p><ul><li><p><span style="color: red"><strong>NOTE:</strong> This database <strong>MUST</strong> already exist before you can connect with the SXIWebServices.</span></p></li></ul></li><li><p><span style="color: blue"><em>DBTriggerTable</em></span> this is the name of the table where the transactions will actually be written to.&#160; <strong>Note:</strong>&#160; This table will be created if it does not already exist. </p></li><li><p><span style="color: blue"><em>DBSyncTimeout</em></span> is a value in seconds indicating how long the <em>Synchronous</em> endpoints will wait for a response before returning to the calling system.&#160; Please see more about the Synchronous operation lower down in this document. </p></li></ol><p>If you have enabled writing transactions to a database your config should include a section that look as follows:</p><div class="codebox"><pre><code>#==============================================================================#
#Do you want the trigger to be inserted into a Database Table: Yes/No
CreateDBRecord=Yes
DBType=MSSQL
DBServer=127.0.0.1
DBPort=1433
DBUser=sa
DBPass=qwerty
DBName=SXI_WS_Transactions
DBTriggerTable=SXIWSTriggers
DBSyncTimeout=15</code></pre></div></li><li><p><strong>The context.xml File:</strong><br />The content.xml file can be found in the <em>[tomcat_dir]/webapps/SXIWebServices/META-INF</em> directory.<br /><span style="color: red"><strong>Do NOT change the configuration option <em>name=&quot;jdbc/sxiwsDB&quot;</em>. It will break the connection pooling.&#160; This will be address by configuration in a later version.</strong></span><br />You will not need to change everything in the Context.xml file and most of the fields are best left unchanged.&#160; However the following will have to be changed:</p><ol class="decimal"><li><p><span style="color: blue"><em>username</em></span> is a user that has suitable permissions to create a table and insert records into the <em>url</em> database</p></li><li><p><span style="color: blue"><em>password</em></span> is the password <em>in clear text</em> for the <em>DBUser</em>.</p></li><li><p><span style="color: blue"><em>url</em></span> must include the SQL server (IP or name):port/&lt;dbname&gt;.</p><ul><li><p><span style="color: red"><strong>Note:</strong> there is no need to change the jdbc:jtds:sqlserver:// part of this url when we are using MSSQLExpress</span></p></li><li><p>If you are wanting to write to a different database you will need to download the database driver jar file that is needed to communicate with that specific database type you are wanting to write to and then copy it into the [tomcat_dir]/lib directory.&#160; You will also need to change the <span style="color: blue"><em>driverClassName</em></span>, <span style="color: blue"><em>type</em></span>and <span style="color: blue"><em>url</em></span> (jdbc:jtds:sqlserver) lines in the Context.xml file.</p></li></ul></li></ol><div class="codebox"><pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE xml&gt;
&lt;Context path=&quot;/SXIWebServices&quot;&gt;
  &lt;Resource 
	auth=&quot;Container&quot; 
	driverClassName=&quot;net.sourceforge.jtds.jdbc.Driver&quot; 
	maxActive=&quot;1000&quot; 
	maxIdle=&quot;30&quot; 
	maxWait=&quot;10000&quot; 
	name=&quot;jdbc/sxiwsDB&quot; 
	password=&quot;qwerty&quot; 
	removeAbandoned=&quot;true&quot; 
	removeAbandonedTimeout=&quot;30&quot; 
	type=&quot;javax.sql.DataSource&quot; 
	url=&quot;jdbc:jtds:sqlserver://localhost:1433/SXI_WS_Transactions&quot; 
	username=&quot;sa&quot; 
	validationQuery=&quot;select 1&quot;/&gt;
&lt;/Context&gt;</code></pre></div></li></ol></li><li><p><strong>Configure transactions to be written to Elastic Search:</strong><br />This can be turned on by changing the <span style="color: blue"><em>CreateXDataRecord</em></span> from <strong>No</strong> to <strong>Yes</strong>.</p><p>You will also need to configure the <span style="color: blue">IP address</span> and <span style="color: blue">port</span> of the Elastic Search index server.</p><p>If you have enabled writing XData records to be processed your config should include a section that look as follows:</p><div class="codebox"><pre><code>#==============================================================================#
#Do you want the trigger to be inserted into the X-Data Index: Yes/No
CreateXDataRecord=Yes
XDataIndexServer=127.0.0.1
XDataIndexPort=9200</code></pre></div></li></ol>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Wed, 28 Nov 2018 18:04:31 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?pid=98#p98</guid>
		</item>
	</channel>
</rss>
