Sunday, February 26, 2012

Setting up a Cassandra cluster using wso2 carbon


If you want to use WSO2 security model with Cassandra cluster here I'll show you, how you can setup a cassandra cluster using wso2 carbon.

First you need to download wso2 carbon (I am using version 3.2.2)

Then install cassandra feature by using the p2 repository from http://dist.wso2.org/p2/carbon/releases/3.2.2/ to wso2 carbon server.

This will install Cassandra 0.7 version to your carbon server.











Adding p2 repository (http://dist.wso2.org/p2/carbon/releases/3.2.2/)












Installing Cassandra 3.2.2 feature


After finishing the installation restart the carbon server. Now carbon server will work as your Cassandra server.


setup few more cassandra nodes using wso2 carbon as above according to your requirement.
You can follow the instruction given by this site for setting up the cassandra cluster.
The cassandra.yaml configuration file is located in $wso2carbon_home/repository/conf/advanced/ directory.


Add following configuration file (cassandra-auth.xml) $wso2carbon_home/repository/conf/advanced/ in order to view keyspaces using Cassandra Keyspaces ui (change the username and password accordingly).


<Cassandra>
   <EPR>https://localhost:9443/services/CassandraSharedKeyPublisher</EPR>
   <User>USERNAME</User>
   <Password>PASSWD</Password>
</Cassandra>

cassandra-auth.xml










Cassandra Keyspaces ui


Once you finish the configuration. You can check the status of the cluster by using Cassandra cluster ui or else You can use nodetool comes with Apache Cassandra to monitor the cluster.









Cassandra cluster monitor ui 


nodetool 

$./nodetool -h 192.168.0.100 -p 9999 ring -u admin -pw admin

Address         Status State   Load            Owns    Token                                    
                                                       113427455640312821154458202477256070485  
192.168.0.100   Up     Normal  20.36 MB        33.33%  0                                        
192.168.0.101   Up     Normal  251.64 MB       33.33% 56713727820156410577229101238628035242    
192.168.0.102   Up     Normal  20.95 MB        33.33%  113427455640312821154458202477256070485

note: remote jmx agent port number in carbon server is 9999 + offset (default offset in carbon.xml is 0)


Thursday, February 16, 2012

Fixing ADB databinding issue when web service method returning OMElement


When I try to call a web service which return an OMElement, I faced above issue (My Axis2 version is 1.6.1). Following I have shown the steps that I did for fixing the issue.

This is the part of the stack trace.


org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Any type  element type has not been given
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at org.wso2.carbon.bam.presentation.stub.QueryServiceStub.fromOM(QueryServiceStub.java:8908)
    at org.wso2.carbon.bam.presentation.stub.QueryServiceStub.queryColumnFamily(QueryServiceStub.java:800)
    at org.wso2.carbon.bam.clustermonitor.ui.ClusterAdminClient.getClusterStatistics(ClusterAdminClient.java:148)


If you check the schema of the response element in your generated wsdl(by axis2) it should similar to this.


<xs:element name="queryColumnFamilyResponse">
      <xs:complexType>
         <xs:sequence>
                <xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType" />
         </xs:sequence>
      </xs:complexType>
</xs:element>

In order to fix the ADB databinding issue you need to change the above schema as follows and regenerate the stub code.


<xs:element name="queryColumnFamilyResponse">
     <xs:complexType>
          <xs:sequence>
              <xs:any processContents="skip"/>
          </xs:sequence>
     </xs:complexType>
</xs:element>

Then ADB will generate code that represents the content of OriginalMessage as an OMElement and this will fix your problem.

Saturday, September 10, 2011

WSO2Con 2011




"WSO2Con is one fantastic week of tutorials, tech talk and networking events. Whether you are a developer, architect, IT manager or technology enthusiast, learn how global enterprises, SaaS providers and innovative startups are using WSO2 platforms to build distributed web apps, java services, bpel flows, Software-as-a-Service (SaaS) and more"

This will be held on September 12-16 at Sri Lanka, You must join this event if you are interested in SOA and Cloud Computing. Not only that there are many other topics (NoSQL,Carbon platform,OSGI,Security,..etc) will be covered in conference and tutorial sessions. 

Also You can find more detail about WSO2 Business Activity Monitoring product, which is  developing with new architecture that can handle large volume of data, also it provides a powerful framework for customizing and monitoring key performance indicators.

Speaker panel consist of experienced speakers from more than 10 countries, including speakers from Google,IBM,..etc.

Complete Aggenda for Wso2 Con 2011 can be found from here.

You can get rough idea of the topics that is going to cover from following image.





Monday, August 22, 2011

How to close, open ports in linux


If you want to close the port 8080, this is an one way of doing this, if you are on ubuntu.

type following command:
> netstat -lpn

This will list all listening ports


Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:49027           0.0.0.0:*               LISTEN      13098/java    
tcp        0      0 127.0.0.1:9160          0.0.0.0:*               LISTEN      13098/java    
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -            
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      13098/java    
tcp        0      0 0.0.0.0:33395           0.0.0.0:*               LISTEN      13098/java    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -            
tcp        0      0 127.0.0.1:7000          0.0.0.0:*               LISTEN      13098/java  


Use grep for filtering out the 8080 port.

You can use following command:
> netstat -lpn | grep 8080

You'll get output something like this

tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      13098/java

Here my process id is 13098 and it is the process that is using port 8080

Kill the process using following command:
> sudo kill 13098

Now port 8080 is free.

Sunday, July 3, 2011

How to re-index all resources in GREG 4.0.0


If you need to re-index all resources in greg 4.0.0, here I have explain how you can do that. 
This can be easily done by editing registry.xml located at CARBON_HOME/repository/conf folder. In registry.xml go to the indexingConfiguration section and then change the resource name of lastAccessTimeLocation to some other value.
Default value:

<lastAccessTimeLocation>/_system/local/repository/components/org.wso2.carbon.registry/indexing/lastaccesstime</lastAccessTimeLocation>

New Value (after changing the resource name):

<lastAccessTimeLocation>/_system/local/repository/components/org.wso2.carbon.registry/indexing/newlastaccesstime</lastAccessTimeLocation>



Now restart the server, then greg will re-index all resources from scratch.


Saturday, July 2, 2011

Reinstall grub2 after installing windows 7 (XP/Vista)


You may need to reinstall grub when windows is installed after ubuntu (or if you reinstalled windows in dual boot (Windows and ubuntu) system). I used following steps for reinstalling grub in order to login to my Ubuntu 10.04 after reinstalling Windows 7 on my machine.

1. boot the ubuntu LiveCD

2. Open a terminal and type
sudo fdisk -l


This list the partition tables, and in my case root (/) partition is on /dev/sda9.

3. Mount that partition using following command.

sudo mount /dev/sda9 /mnt

4. Run the grub-install command as below. This will reinstall the grub 2
sudo grub-install --root-directory=/mnt /dev/sda
Here "sda" is the hard disk on which your Linux distribution is installed!

5. Reboot

6. Finally Refresh the grub 2 menu using following command

sudo update-grub

Now everything should be fine :)



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