User Tools

Site Tools


wso2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
wso2 [2021/09/14 09:02]
Jan Forman
wso2 [2021/09/14 09:02] (current)
Jan Forman
Line 1: Line 1:
 +====== WSO2 Microintegrator ======
  
 +===== Copy data from one DB to another by dataservice =====
 +<code>
 +<data enableBatchRequests="true" name="transferMAIL" transports="http https local">
 +<!-- define source and destination -->
 +   <config enableOData="false" id="DataSource">
 +      <property name="driverClassName">org.mariadb.jdbc.Driver</property>
 +      <property name="url">jdbc:mariadb://host:3306/portal</property>
 +      <property name="username"></property>
 +      <property name="password"></property>
 +   </config>
 +   <config enableOData="false" id="DataDestination">
 +      <property name="driverClassName">org.mariadb.jdbc.Driver</property>
 +      <property name="url">jdbc:mariadb://host:3306/portal</property>
 +      <property name="username"></property>
 +      <property name="password"></property>
 +   </config>
 +
 +<!-- truncate destionation table -->
 +   <query id="clean" useConfig="DataDestination">
 +      <sql>DELETE FROM yyy</sql>
 +   </query>
 +
 +<!-- nested query insert data -->
 +   <query id="insertDATA" useConfig="DataDestination">
 +      <sql>INSERT INTO yyy (Email) VALUES (:Email)</sql>
 +      <param name="Email" sqlType="STRING"/>
 +   </query>
 +
 +<!-- read and write data using nested query -->
 +   <query id="copy" useConfig="DataSource">
 +      <sql>SELECT Email FROM zzz</sql>
 +      <!-- loop data -->
 +      <result element="Entries" rowName="Entry">
 +         <element column="Email" name="Email" xsdType="string"/>
 +         <!-- insert data -->
 +         <call-query href="insertDATA" requiredRoles="">
 +            <with-param column="Email" name="Email"/>
 +         </call-query>
 +      </result>
 +   </query>
 +
 +<!-- define operation -->
 +   <operation name="copy">
 +      <call-query href="copy"></call-query>
 +   </operation>
 +   <operation name="clean">
 +      <call-query href="clean"></call-query>
 +   </operation>
 +</data>
 +</code>
 +
 +<code>/usr/lib64/wos2/wso2ei</code>
 +\\
 +===== conf/datasources/master-datasources.xml =====
 +<code>
 +<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
 +    <providers>
 +        <provider>org.wso2.micro.integrator.ndatasource.rdbms.RDBMSDataSourceReader</provider>
 +    </providers>
 +    <datasources>
 +    <datasource><name>RCS</name><definition type="RDBMS"><configuration><driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName><url>jdbc:oracle:thin:@10.160.177.37:1521/orapl</url><username>user</username><password
 +encrypted="false">pass</password></configuration></definition></datasource>
 +    </datasources>
 +</datasources-configuration>
 +</code>
 +
 +
 +===== WSO2 API Manager =====
 +API Manager with Analytics - There was a backup task (snapshot) at 23h GMT.
 +{{:wso2api-analytics.png?nolink|}}
 +
 +===== Mailtransport =====
 +<code>
 +<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
 +        <parameter name="mail.smtp.host">10.160.150.82</parameter>
 +        <parameter name="mail.smtp.port">25</parameter>
 +        <parameter name="mail.smtp.starttls.enable">false</parameter>
 +        <parameter name="mail.smtp.auth">false</parameter>
 +        <parameter name="mail.smtp.user"></parameter>
 +        <parameter name="mail.smtp.password"></parameter>
 +        <parameter name="mail.smtp.from">noreply@janforman.com</parameter>
 +    </transportSender>
 +</code>
 +===== Database connection =====
 +
 +Connect MariaDB JDBC Driver (different from MySQL template)
 +{{::wso2-mariadb.png?nolink|}}
 +
 +
 +===== WSO2 Data Services Server =====
 +Connect to PostgreSQL DB and create REST API XML / JSON
 +<code>
 +<data name="sde" transports="http https">
 +   <config id="sde">
 +      <property name="driverClassName">org.postgresql.Driver</property>
 +      <property name="url">jdbc:postgresql://10.160.150.86:5432/sde</property>
 +      <property name="username"></property>
 +      <property name="password"></property>
 +   </config>
 +   <query id="tabory" useConfig="sde">
 +      <sql>select nazev,jtskx,jtsky from tabory</sql>
 +      <result element="tabory" rowName="nazev">
 +         <element column="nazev" name="nazev" xsdType="string"/>
 +         <element column="jtskx" name="jtskx" xsdType="string"/>
 +         <element column="jtsky" name="jtsky" xsdType="string"/>
 +      </result>
 +   </query>
 +   <operation name="operation">
 +      <call-query href="tabory"/>
 +   </operation>
 +   <resource method="GET" path="tabory">
 +      <call-query href="tabory"/>
 +   </resource>
 +</data>
 +</code>
 +
 +<code>
 +<data name="getJPOid" transports="http">
 +   <config enableOData="false" id="portal">
 +      <property name="driverClassName">org.mariadb.jdbc.Driver</property>
 +      <property name="url">jdbc:mariadb://10.0.0.0/global</property>
 +      <property name="username"></property>
 +      <property name="password"></property>
 +   </config>
 +   <query id="query" useConfig="portal">
 +      <sql>SELECT KATEGORIE,NAZEV_JPO,EVCJ,DP,STATUS,X,Y FROM global.jpo WHERE EVCJ = ?</sql>
 +      <result element="list" rowName="jpo">
 +         <element column="NAZEV_JPO" name="nazev_jpo" xsdType="string"/>
 +         <element column="X" name="lon" xsdType="string"/>
 +         <element column="Y" name="lat" xsdType="string"/>
 +         <element column="EVCJ" name="evcj" xsdType="string"/>
 +         <element column="KATEGORIE" name="kategorie" xsdType="string"/>
 +         <element column="DP" name="dp" xsdType="string"/>
 +         <element column="STATUS" name="status" xsdType="string"/>
 +      </result>
 +      <param name="evcj" sqlType="STRING"/>
 +   </query>
 +   <operation name="get">
 +      <call-query href="query">
 +         <with-param name="evcj" query-param="evcj"/>
 +      </call-query>
 +   </operation>
 +   <resource method="GET" path="/">
 +      <call-query href="query">
 +         <with-param name="evcj" query-param="evcj"/>
 +      </call-query>
 +   </resource>
 +</data>
 +</code>
 +
 +<code>
 +<data name="getCHTS" transports="http">
 +   <config enableOData="false" id="rcs">
 +      <property name="driverClassName">oracle.jdbc.driver.OracleDriver</property>
 +      <property name="url">jdbc:oracle:thin:@IP:1521/orcl</property>
 +      <property name="username"></property>
 +      <property name="password"></property>
 +   </config>
 +   <query id="query" useConfig="rcs">
 +   <sql>SELECT K_VP_CHTS, N_VP_CHTS, VYROBCE_TYP, I_VP_CHTS, USER_KEY,(SELECT VYR_CISLO FROM VP_CHTS_DSP WHERE VP_CHTS_DSP.K_VP_CHTS = VP_CHTS.K_VP_CHTS) AS VYR_CISLO FROM VP_CHTS WHERE (KC_TPO = 501141 OR KC_TPO = 501145 OR KC_TPO = 501144) AND X_VP_CHTS = 1</sql>
 +         <result element="list" rowName="Lahev">
 +         <element column="K_VP_CHTS" name="CHTS_K" xsdType="string"/>
 +         <element column="N_VP_CHTS" name="CHTS_NAME" xsdType="string"/>
 +         <element column="VYROBCE_TYP" name="CHTS_TYPE" xsdType="string"/>
 +         <element column="I_VP_CHTS" name="CHTS_INFO" xsdType="string"/>
 +         <element column="VYR_CISLO" name="CHTS_VYRCISLO" xsdType="string"/>
 +         <element column="USER_KEY" name="CHTS_USERKEY" xsdType="string"/>
 +      </result>
 +   </query>
 +   <operation name="get">
 +      <call-query href="query"/>
 +   </operation>
 +   <resource method="GET" path="/">
 +      <call-query href="query"/>
 +   </resource>
 +</data>
 +</code>
 +
 +
 +json ->
 +<code>
 +<query id='sample' useConfig='default'>
 +<sql>select * from Employees where id = ?</sql>
 +<result outputType='json'>
 +{ "employees":{
 +   "employee":[
 +               {
 +               "lastName":"$lastname",
 +               "firstName":"$firstname",
 +               }
 +              ]
 +             }
 +}
 +</result>
 +<param name='id' ordinal='1' sqlType="INTEGER"/>
 +</query>
 +</code>
 +
 +===== Redirected to localhost? =====
 +<code>
 +carbon.xml file under /repository/conf folder.
 +Change <HostName>localhost</HostName> to your IP.
 +</code>
wso2.txt · Last modified: 2021/09/14 09:02 by Jan Forman