Subscribe:

Ads 468x60px

Pages

Featured Posts

Tuesday, January 27, 2015

Spring Integration With Axis2 Services

Introduction

This tutorial describes how to handle object injection in axis2 service classes using spring framework.

Sample Service Class For The Tutorial

package services;

public class SimpleService {

    private SampleClass sampleClass;    

    public SimpleService(SampleClass sampleClass){
        this.sampleClass = sampleClass;    
    }

    public String echo(String echo){
        return echo;
    }   
 }

Configure pom.xml

Add maven dependancies in pom.xml 

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb</artifactId>
            <version>${axis2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-http</artifactId>
            <version>${axis2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-local</artifactId>
            <version>${axis2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-spring</artifactId>
            <version>1.4.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-api</artifactId>
            <version>1.2.14</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-impl</artifactId>
            <version>1.2.14</version>
        </dependency>

Configure web.xml

Add Following Servlet and Servlet Mappings 

    <servlet>
        <servlet-name>AxisServlet</servlet-name>
        <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

Configure spring.xml

Define spring bean for the Web Service Class 

    <bean id="simpleService" class="services.SimpleService">
    <constructor-arg ref="sampleClass"/>
    </bean>

Configure services.xml

Define the Web Service 

<service name="SimpleService">    
        <parameter name="ServiceClass">services.StatisticsDepartmentService</parameter>
        <description>SimpleService</description>
        <parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier </parameter>
        <parameter name="SpringBeanName">simpleService</parameter>
        <operation name="echo">
            <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
        </operation>
    </service>

Monday, September 9, 2013

Generating Web Service Artifacts In Client Side

When we are implementing the client side web service programming logic with JAX-WS we need to have the web service artifacts such as Service Endpoint Interfaces, Service classes, JAXB elements and other artifacts. These are derived from the WSDL file of the web service. The wsimport tool provided in JDK is used to generate the web service artifacts from a remote WSDL file which can be accessed over the network.



Syntax: wsimport <flags> <link to wsdl>

Eg: wsimport -keep http://stockquote.xyz/quote?wsdl

TCPMon as a Web Service Troubleshooting Tool

TCPMon is a simple tool developed by apache which can be used as a very useful tool when you are playing around to implement a web service or a web service client. TCPMon provides an interface to directly forward the raw SOAP messages to web service. And also returns the response SOAP message if the web service accepted the SOAP request successfully. Otherwise it'll return the error message to TCPMon. We have to specify the web service WSDL file in the connection end point file. It's Important to verify that the XML SOAP message is syntactically correct before sending. Because TCPMon doesn't validate or identify the syntax errors in the SOAP XML by it self.  

Sunday, March 4, 2012

Simple Python Web Server

This is about a simple web server which I have done for an assignment. Server implemented using python language and it's standard libraries. This simple web server facilitates for GET request and server is capable with handling few HTTP error codes. Server configurations can be manipulated using external configuration file. Some configurable values are web root path, host IP, etc. This server successfully tested on Ubuntu 10.10      

>>Download


Monday, October 17, 2011

Installing GPSIM

Hi there., nowadays I'm playing around with micro controllers. Before to get involve with MCUs physically I wanted to try it virtually. As a Linux user I Googled for a linux software to simulate my MCU programs. I found out a software GPSIM (GNU PIC Simulator). But while I'm building the GPSIM I met with a problem and googled for the solution. Unfortunately there wasn't. So I get on to work and got a solution my self.  

Basically it's required to install following dependencies before.

gputils (GNU PIC Utils)
sdcc (Small Device C Compiler)

Then it's time to build and install the GPSIM

while I'm executing the ./configure I met with a problem. first there popt.h file missing. so I have to install package included that header file. and then the biggest problem was occurred.
                     To install gpsim, it's required to be installed gtkextra-2.0 package.
I couldn't find out the gtkextra-2.0. Instead of that I have installed gtkextra-3.0

But while I configuring, terminal prompts an Error.


checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find gtkextra-2.0 package

Although there's  no problem with gtkextra package I examined the source code of the configure file. I saw that there's a code in the configure file which is shown below

$PKGCONFIG --exists gtkextra-2.0
  if test $? != 0; then
    as_fn_error $? "Cannot find gtkextra-2.0 package" "$LINENO" 5
  fi

  X_LDFLAGS=`$PKGCONFIG --libs gtk+-2.0 gthread-2.0`
  X_CFLAGS=`$PKGCONFIG --cflags gtk+-2.0`
  Y_LDFLAGS=`$PKGCONFIG --libs gtkextra-2.0`
  Y_CFLAGS=`$PKGCONFIG --cflags gtkextra-2.0`
  GTK_VERSION_T=`$PKGCONFIG --modversion gtk+-2.0`


this code always search for the older version of the gtkextra package even computer has it's latest version. So I replaced 'gtkextra-2.0' with 'gtkextra-3.0'

Note: Keep a copy of the Configure file before you edit it.
Note: You cannot edit it without root privileges. So use


                     $ sudo gedit configure

Note: Always replace your currently running gtkextra package version. It's  gtkextra-3.0 in my case. To find out version of yours

               $ pkg-config --list-all | grep gtk

Note: install any other dependencies. In my case I had missing packages libpopt-dev (for popt.h)

Then I was able to get through the configuration process painlessly. Then executed

           $ sudo make

           $ sudo make install

I thought that it's almost done. But it wasn't, an error was prompted.

~/gpsim-0.26.1$ gpsim
gpsim: error while loading shared libraries: libgtkextra-x11-3.0.so.1: cannot open shared object file: No such file or directory


Searched for the missing package 'libgtkextra-x11-3.0' library and downloaded the built packages

libgtkextra-x11-3.0-0   and libgtkextra-x11-3.0-dev


installed sequently

$ sudo dpkg -i libgtkextra-x11-3.0-0_3.0-0ubuntu3_i386.deb

$ sudo dpkg -i libgtkextra-x11-3.0-dev_3.0-0ubuntu3_i386.deb

then it works without any trouble ...  :D

Saturday, June 11, 2011

Installing mysql on Ubuntu

I wanted to install mysql on my Ubuntu os. As a biginner to Ubuntu I found that it's some what difficult thing to do. However I came across my problem after struggling two days with command terminal. I'd like to share my experiences, faults I which have faced during my installation process.
First I found out that I must install mysql-client and mysql-server. So I used (I suggest you to use the root account during this)

sudo apt-get install mysql-client mysql-server

(Note: You must be online when you are doing this)
This will install mysql for you. You just only need to follow the instructins that asked to do. But in my case this wasn't done, I was ended up with an error

Err http://archive.ubuntu.schoolnet.lk/ubuntu/maverick-updates/main mysql-server all 5.1.49-1ubuntu8.1 403 Forbidden

And so on. 


I couldn't understood the exact reason for that but I think my weak network connection might cause for that. Well.., I was not in a mind to give up this. So I went through the link which showed in the error message and I downloaded those files from the archive

(Note: http://archive.ubuntu.schoolnet.lk/ is dedicated ubuntu archive for Sri Lanka. If haven't configured your PC to the nearest ubuntu server at your location, you have to do it first)
After Downloading those missing stuffs I installed those packages using below command

 dpkg -i mysql server_5.1.49-1ubuntu8.1_all.deb
You'll have to answer some questions like password, etc
proceed with the process. After that process you have installed mysql successfully. To check whether it's working or not use:

netstat -tap | grep mysql
If it's working properly you'll see something like this

~$ netstat -tap | grep mysql
tcp        0      0 localhost.localdo:mysql *:*              LISTEN    -              

Finally to run the mysql on command terminal 

mysql -u root -h localhost -p
Then it'll ask for the password. give the password which you have given in the installation process. That's all, now you can see the command terminall turned in to a mysql console.

mysql -u root -h localhost -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 40
Server version: 5.1.49-1ubuntu8.1 (Ubuntu)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>



To exit from the mysql console:

mysql> exit

Sunday, March 6, 2011

device is not ready (firmware missing)...!!

Hi there, Nowadays I'm playing around Ubuntu 10.10 because I had to do big works with command terminal which need for my 2nd semester subjects. I haven't installed Ubuntu to my laptop (Dell XPS M1210) before. But I knew I'll have to get it soon to my laptop. However I was in a doubt whether my laptop can bear two OS's because my HDD is too small comparatively to others. Whatever I decided to install Ubuntu 10.10 and no matter, it's running easily. But I saw that my wi-fi status indicator not coming to active status even I switched it into active mode. And I saw the network connections icon in top of the desktop is showing a red exclamation mark also. It's indicating "device is not ready (firmware missing)" under the wireless networks. Finally I found a solution for that after surfing some web sites. There are two solutions as I got it. If you can gain a Internet connection using other source like wired Ethernet, etc. It'll be a easy case for you. 

Here's the correct place you must follow: http://wireless.kernel.org/