Thursday, August 20, 2015

XSD refered another XSD in wso2 ESB, Governes Registry

1. Install MySQL in Ubuntu and create set of tables which are mapped to governance entries

  • To install mysql : sudo apt-get install mysql-server
  • To log into mysql: mysql -u root -p
  • To view the status :  sudo service mysql status
  • Create database : CREATE DATABASE GOV_REG_DB
  • Use the created database :  use GOV_REG_DB
  •  Run the sql script inside esb to create tables : source /home/sachini/Desktop/wso2/software/WSO2/wso2esb-4.8.1/dbscripts/mysql.sql

 2. Configure wso2 ESB and wso2 governance registry to connect with MYsql

  • Go to <ESB_HOME>/repository/conf/datasources and open master-datasources.xml and add following code to add a datasource(change the DB name according to your DB)
    
<datasource>
   <name>GOV_REG_DB</name>
   <description>The datasource used for registry and user manager</description>
   <jndiConfig>
      <name>jdbc/GOV_REG_DB</name>
   </jndiConfig>
   <definition type="RDBMS">
      <configuration>
         <url>jdbc:mysql://localhost:3306/GOV_REG_DB</url>
         <username>root</username>
         <password />
         <driverClassName>com.mysql.jdbc.Driver</driverClassName>
         <maxActive>50</maxActive>
         <maxWait>60000</maxWait>
         <testOnBorrow>true</testOnBorrow>
         <validationQuery>SELECT 1</validationQuery>
         <validationInterval>30000</validationInterval>
      </configuration>
   </definition>
</datasource>
  • Go to <ESB_HOME>/repository/conf  and add following to registry.xml
                    <dbConfig name="sharedregistry">
                                 <dataSource>jdbc/GOV_REG_DB</dataSource>
                       </dbConfig>

                      <remoteInstance url="https://localhost:9444/registry">
                           <id>instanceid</id>
                           <dbConfig>sharedregistry</dbConfig>
                           <readOnly>false</readOnly>
                           <enableCache>true</enableCache>
                           <registryRoot>/</registryRoot>
                           <cacheId>root@jdbc:mysql://localhost:3306/GOV_REG_DB</cacheId>
                     </remoteInstance>

                    <mount path="/_system/governance" overwrite="true">
                        <instanceId>instanceid</instanceId>
                        <targetPath>/_system/governance</targetPath>
                     </mount>
  •  Go to wso2greg-4.6.0/repository/conf and add following to master-datasources.xml 
     <dbConfig name="sharedregistry">
         <dataSource>jdbc/GOV_REG_DB</dataSource>
   </dbConfig>

   <remoteInstance url="https://localhost:9444/registry">
           <id>instanceid</id>
           <dbConfig>sharedregistry</dbConfig>
           <readOnly>false</readOnly>
           <enableCache>true</enableCache>
           <registryRoot>/</registryRoot>
           <cacheId>root@jdbc:mysql://localhost:3306/GOV_REG_DB</cacheId>
   </remoteInstance>

   <mount path="/_system/governance" overwrite="true">
            <instanceId>instanceid</instanceId>
            <targetPath>/_system/governance</targetPath>
   </mount>

 After that the database will be mounted to governance registry.
 Restart the ESB and governance registry.

3. Upload the wsdl,xsd files(listing5.wsdl, listing4.xsd, listing3.xsd) to governance registry as a gar file




 Then you will be able to see the wsdl under /_system/governance/trunk/wsdls/listing5/listing5.wsdl and both xsd under /_system/governance/trunk/schemas/listing3/listing3.xsd and /_system/governance/trunk/schemas/listing4/listing4.xsd


Like that in ESB console you can see those files as below



 4. Change the reference schema location for listing3.xsd in listing5.wsdl file according to relative path

schemaLocation="../../schemas/listing3/listing3.xsd"


Like that open listing3.xsd and change the reference schema location like

schemaLocation="../listing4/listing4.xsd" (according to relative path from listing3 folder)

Blogger Widgets