Saturday, April 16, 2011

WSDL to UDDI Mapping





Introduction


Universal Description, Discovery and Integration (UDDI) is a platform independent, Extensible Markup Language (XML) based registry and it provides a mechanism for describing and discovering Web service providers, Web services and technical interfaces which may be used to access those services. There are several UDDI implementations are available (Apache jUDDI [1], OpenUDDI Server etc.). The Web Services Description Language (WSDL) is an XML based language for describing the interface, protocol bindings, and the deployment details of network services. The objective of this blog is to show the relationship between WSDL and UDDI and to describe a mechanism for mapping WSDL service descriptions to the UDDI data structures.The information in this blog adheres to the procedures outlined in OASIS UDDI Technical Note [2] and is consistent with the UDDI Version 3.0.2 Specification [3].

 



How to invoke a service using UDDI registry


UDDI is designed to be interrogated by SOAP messages and to provide access to WSDL documents describing service binding information required to interact with the web services listed in the registry.
Add caption





The steps involved in providing and consuming a service are:

  1. A service provider (business) describes its service using WSDL. This definition is published to a UDDI registry.
  2. A service consumer lookup the service in the UDDI registry and receives service binding information that can be used to determine how to communicate with that service.
  3. The client then uses the binding information to invoke the service.




    How to Map WSDL Document in UDDI.


    This mapping describe a methodology to map WSDL 1.1 documents to UDDI version 3. Before going into details of mapping, it is important to understand the UDDI data structures. Here I have briefly described the data structures in UDDI.


    UDDI data structures


    • businessEntity - A businessEntity structure used to represent the business or service provider within UDDI.
    • businessService - A businessService structure used to represent a web service. A businessEntity can have several businessServices.
    • bindingTemplate - A binding template contains the technical information associated to a particular service. A businessService can have several bindingTemplates
    • Technical Model (tModel) - A tModel is a generic container of information where designers can write any technical information associated for using the Web service.


    WSDL portType to tModel Mapping


    The information represent about a WSDL portType by the UDDI tModel is its entity type, local name, namespace, and location of the WSDL document that defines the portType. Each WSDL portType maps to a UDDI tModel having the same name as local name of the portType in the WSDL. The overviewURL provides the location of the WSDL document. In addition to that tModel contains a category bag with keyedReferences for type categorization as “portType” and namespace of the portType (If the wsdl:portType has a targetNamespace).


    Following is the structure of UDDI portType tModel

    <tModel tModelKey="uuid:e8cf1163-8234-4b35-865f-94a7322e40c3">
    <name>
        [WSDL portType local name]
    </name>
    <overviewDoc>
        <overviewURL useType=”wsdlInterface>
            [WSDL location URL]
        </overviewURL>
    </overviewDoc>
    <categoryBag>
        <keyedReference
                tModelKey="uddi:uddi.org:xml:namespace"
                keyName="portType namespace"
                keyValue="[WSDL namespace]"/>
        <keyedReference
                tModelKey="uddi:uddi.org:wsdl:types"
                keyName="WSDL type"
                keyValue="portType"/>
    </categoryBag>
    </tModel>


    WSDL binding to tModel Mapping



    The information represent about a WSDL binding by the UDDI tModel is its entity type, local name, namespace, the location of the WSDL document that defines the binding, the portType that it implements, protocol, and optionally the transport information. Each WSDL binding maps to a UDDI tModel having same name as local name of the binding in the WSDL. The overviewURL provides the location of the WSDL document. In addition to that tModel contains a category bag with following keyedReferences


    • namespace of the binding (If the wsdl:binding has a targetNamespace).
    • type categorization as “binding”
    • binding characterized as type "wsdlSpec".
    • portType reference for wsdl:portType to which the wsdl:binding relates.
    • protocol categorization
    • transport categorization


      Following is the structure of UDDI binding tModel


      <tModel tModelKey="uuid:49662926-f4a5-4ba5-b8d0-32ab388dadda">
      <name>
          [WSDL binding local name]
      </name>
      <overviewDoc>
          <overviewURL useType=”wsdlInterface>
              [WSDL location URL]
          </overviewURL>
      </overviewDoc>
      <categoryBag>
          <keyedReference
                  tModelKey="uddi:uddi.org:xml:namespace"
                  keyName="binding namespace"
                  keyValue="[WSDL namespace]"/>
          <keyedReference
                  tModelKey="uddi:uddi.org:wsdl:types"
                  keyName="WSDL type"
                  keyValue="binding"/>
          <keyedReference
                  tModelKey="uddi:uddi.org:categorization:types"
                  keyName="uddi-org:types"
                  keyValue="wsdlSpec"/>
          <keyedReference
                  tModelKey="uddi:uddi.org:wsdl:porttypereference"
                  keyName="portType reference"
                  keyValue="[tModel key of the PortType]"/>
          <keyedReference
                  tModelKey="uddi:uddi.org:wsdl:categorization:protocol"
                  keyName="[Protocol supported by the binding]"
         keyValue= "[tModel key of the Protocol tModel]" />
          <keyedReference
                  tModelKey="uddi:uddi.org:wsdl:categorization:transportport"
                  keyName="[Transport]"
           keyValue="[tModel key of the Transport tModel]" />
      </categoryBag>
      </tModel>


      WSDL port to UDDI bindingTemplate Mapping



      A WSDL port maps to a bindingTemplate. The information represent about a WSDL port by the UDDI bindingTemplate is the binding that it implements, the portType that it implements, local name of the port and access point of the service. The bindingTemplate has tModelInstanceDetails element which contain the following tModelInstanceInfo elements.


      • tModelInstanceInfo with a tModelKey of the tModel corresponding to the binding that port implements. The instanceParms represent wsdl:port local name.
      • A tModelInstanceInfo with a tModelKey of the tModel corresponding to the portType that port implements.
      • The accessPoint is set from the location attribute on the extension element that is associated with the port element.


      WSDL service to UDDI businessService Mapping


      A WSDL service maps to a businessService. The information represent about a service by the UDDI businessService is its entity type, local name, namespace, and the list of ports that it supports. The name of the businessService can be represented by the local name of the service in the WSDL. In addition to that businessService contains a category bag with following keyedReferences
        • namespace of the service
        • local name of the service
        • type categorization as “service”

      Following is the structure of UDDI businessService and bindingTemplate

      <businessService
              serviceKey="102b114a-52e0-4af4-a292-02700da543d4"
              businessKey=[businessKey of the bussinessEntity which this service belongs]>
          <name>[Service local name]</name>
          <bindingTemplates>
              <!--WSDL port maps to a bindingTemplate-->
              <!--1 or more repetitions-->
              <bindingTemplate
                      bindingKey="f793c521-0daf-434c-8700-0e32da232e74"
                      serviceKey="102b114a-52e0-4af4-a292-02700da543d4">
                  <accessPoint useType="endpoint">
                      [EndPoint URL]
                  </accessPoint>
                  <tModelInstanceDetails>
                      <!-- TModelInstanceInfo indicating the binding-->
                      <tModelInstanceInfo
                              tModelKey=[tModel key of the binding tModel]>
                          <description xml:lang="en">
                              The wsdl:binding that this wsdl:port implements. The instanceParms specifies the port local name.
                          </description>
                          <instanceDetails>
                              <instanceParms>[WSDL port local name]</instanceParms>
                          </instanceDetails>
                      </tModelInstanceInfo>
                      <!--TModelInstanceInfo indicating portType -->
                      <tModelInstanceInfo
                              tModelKey=[tModel key of the portType tModel]>
                          <description xml:lang="en">
                              The wsdl:portType that this wsdl:port implements
                          </description>
                      </tModelInstanceInfo>
                  </tModelInstanceDetails>
              </bindingTemplate>
          </bindingTemplates>
          <categoryBag>
              <keyedReference
                      tModelKey="uddi:uddi.org:xml:namespace"
                      keyName="service namespace"
                      keyValue="[Service namespace Value]"/>
              <keyedReference
                      tModelKey="uddi:uddi.org:xml:localname"
                      keyName="service local name"
                      keyValue="[Service local name value]"/>
              <keyedReference
                      tModelKey="uddi:uddi.org:wsdl:types"
                      keyName="WSDL type"
                      keyValue="service"/>
          </categoryBag>
      </businessService>

      Summary


      • WSDL portType element is mapped to a UDDI tModel
      • WSDL binding element is mapped to a UDDI tModel.
      • WSDL port element is mapped to a UDDI bindingTemplate which has information about the WSDL binding and the WSDL portType implemented by port.
      • Finally WSDL service element is mapped to a UDDI businessService.


      This blog post has shown how to map WSDL document to the UDDI registry using the approach described in the OASIS UDDI Technical Note[2] also it adheres to the UDDI Version 3.0.2 Specification [3]

      References









      Friday, November 19, 2010

      Generating project structure using Maven

      To generate the project structure using maven, we use maven's archetype mechanism. In Maven, an archetype is a template of a project which is combined with some user input to produce a working Maven project that has been tailored to the user's requirements (This help you generate the desired project structure depending on the application that you are trying to build.)


      Following I have shown how you can use maven to generate a project structure for simple java application.


      mvn archetype:create -DgroupId=org.wso2.carbon -DartifactId=sample -DarchetypeArtifactId=maven-archetype-quickstart


      This will generate a project structure as follows



      |-- sample
      |   |-- pom.xml
      |   `-- src
      |       |-- main
      |       |   `-- java
      |       |       `-- org
      |       |           `-- wso2
      |       |               `-- carbon
      |       |                   `-- App.java
      |       `-- test
      |           `-- java
      |               `-- org
      |                   `-- wso2
      |                       `-- carbon
      |                           `-- AppTest.java



      This will create App.java with package name as org.wso2.carbon and create default pom.xml as well as AppTest.java class for unit testing.

      Friday, November 12, 2010

      How to find files in Ubuntu using Terminal

      Case insensitive searches can be achieved by using the -iname switch

      find /home -iname '*.mpg' -o -iname '*.avi'


      Let'search for .avi files bigger than 700M. This can be done with.

      find /home/ -name '*.avi' -a -size +700M


      Now, let's find the same subset of files that were modified less than 15 days ago

      find /home/ -name '*.avi' -a -size +700M -mtime -15

      Thursday, November 11, 2010

      Creating a simple data service using WSO2 Data Services Server

      Here I am going to illustrate, how to use WSO2 Data Services Server for exposing data in a mysql database as a service.

      Prerequisites

      • WSO2 Data Services Server - download it from here 

      • MySQL 5 or later version - download it from here

      • JDK 1.5 or Higher

      Let's create a database with a single table. Below I have given a mysql script for creating database with some data.


      --
      -- Create schema AccountDB
      --
      
      CREATE DATABASE IF NOT EXISTS AccountDB;
      USE AccountDB;
      
      --
      -- Definition of table `AccountDB`.`account`
      -- 

      CREATE TABLE  `AccountDB`.`account` (
        `account_no` int(10) unsigned NOT NULL,
        `name` varchar(45) NOT NULL,
        `balance` int(11) NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

      --
      -- Dumping data for table `AccountDB`.`account`
      --

      INSERT INTO `AccountDB`.`account` VALUES  (1,'Michael',2000),
       (2,'David',3000),
       (3,'Kasun',1500),
       (4,'Mike',1500),
       (5,'Lucas',1500),
       (6,'John',1500),
       (7,'Robin',1500),
       (8,'Daniel',1500),
       (9,'Paul',1500),
       (10,'Oliver',1500);

      Here I have given the data services configuration file that I used.  You can refer this  documentation for creating the data service using data services server user interface, or you can write the dbs configuration file and upload it to data services server. Since we are using a MySQL database, you should copy mySQL JDBC driver to DSS_HOME/repository/components/lib


      Here I have given my data services configuration file

      <data name="AccountDataService" enableBatchRequests="false" enableBoxcarring="false" serviceStatus="active">  
         <config id="Account">     
            <property name="org.wso2.ws.dataservice.driver">

                com.mysql.jdbc.Driver
           </property>     
            <property name="org.wso2.ws.dataservice.protocol">

                jdbc:mysql://localhost:3306/AccountDB
           </property>   
            <!-- use your own mysql database username -->      
            <property name="org.wso2.ws.dataservice.user">root</property>    

            <!-- use your own mysql database password -->     
            <property name="org.wso2.ws.dataservice.password">password</property>      </config>  
         <query id="AccountDetails" useConfig="Account">     
            <sql>select account_no, name, balance from account </sql>     
            <result element="account_details" rowName="account"> 

               <!-- mapping database columns to output field-->       
               <element name="accountNo" column="account_no" xsdType="xs:integer" />        
               <element name="name" column="name" xsdType="xs:string" />        
               <element name="balance" column="balance" xsdType="xs:integer" />     
            </result>  
         </query>  
         <operation name="getAccountDetails">     
            <description></description>     
            <call-query href="AccountDetails" />  
         </operation>
      </data> 


      After uploading the dbs file to the Data Services Server, Now you can see the Newly added AccountDataService in the services page. (Go to Manage->Services->List). Then you can try the service using "Try it".




       

      Ubuntu Terminator useful shortcuts


      Screenshot of the Terminator 
       
      
      
       Ctrl+Shift+X -  Toggle between  showing  all  terminals  and  only  showing  the current 
       one.
      
      
       Ctrl+Shift+O - Split terminals Horizontally.
      
      
       Ctrl+Shift+E - Split terminals Vertically.
      
      
       Ctrl+Shift+Right - Move parent dragbar Right.
      
      
       Ctrl+Shift+Left - Move parent dragbar Left.
      
      
      Ctrl+Shift+Up - Move parent dragbar Up.
      Ctrl+Shift+Down - Move parent dragbar Down.
       Ctrl+Shift+W - Close the current terminal.
      
      
       Ctrl+Shift+T -   Open new tab
      
      
       Ctrl+Plus (+) -  Increase  font  size. Note: this may require you to press shift, depending on your keyboard
      
      
       Ctrl+Minus (-) - Decrease font size. Note: this may require you to  press  shift, 
       depending   on your  keyboard
        
       Ctrl+Zero (0) - Restore font size to original setting.