Wednesday, November 5, 2014

Basic Linux commands

Useful  Linux Commands:

1. How to find and kill a process in Unix:

find a process: ps -ef |grep tomcat

kill process: kill -9 (pid)

2.How will you figure out free available space in Uni

Ans: df command – Shows the amount of disk space used and available on Linux file systems.du command – Display the amount of disk space used by the specified files and for each subdirectory.
df -h

3. Help for any command

man  command name like man df

4.How will you find files recursively that contains specific words in their contents
Search for a given string in all files recursively
 
$ grep -r "ramesh" * 

 
  
5.Search for a given string in a file (case in-sensitive search)
$ grep -i "the" demo_file
 

6. How will you find files recursively that contains specific words in their filename
  
find . -maxdepth 1 -name "*string*" -print 
It will find all files in the current directory (delete maxdepth 1 if you want
it recursive) containing "string" and will print it on the screen.

7.How to sort a file using unix command
sort -filename
for numeric sort
sort -n filename

reverse sort
sort -r filename      

reverse sort without duplicate

sort -u -i filename

8. How to count number of lines in a file in unix terminal

wc sort.txt
 
output : 5  5 41 sort.txt 
The three numbers produced in output correspond to number of lines, 
number of words and number of bytes 

9.How will you list nth column of a flat file in Unix ?
awk '{ print $2 $4 }' filename.txt
 
10.How will you find a process using specific port in Unix and Windows ?
 
netstat -tulpn
 
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1138/mysqld     
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      850/portmap        
  
filter for specfic port:
netstat -tulpn | grep :80 

11.How will you copy a file from one Unix host to another Unix host
In the following example, transfer all files (/var/www/html) from remote server called server1 to another server called server2:
scp -r user@server1:/var/www/html/ user@server2:/var/www/html/


I recommend using rsync command which will only push or download updated files. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. In this example, copy files from remote server called server1 into /backup directory:
rsync -avz -e ssh user@server1:/var/www/html /backup 
 
 


Basic Linux/Unix Commands Part1


Command
Explanation
Commands are entered at terminal
Unix is case sensitive
~ Home directory
_ and hyphen allowed in file names, spaces
are not allowed
hidden files start with .
There is no recycle bin in Unix. Files deleted cannot be restored.
every user has a home directory denoted by ~
passwd
Change password
ls
ls –l <directory>ls -l <directory>ls -t
ls -a
ls -la
List files and subdirectories
All information of files or subdirectories
/<fullpath>
Sort by creation time
all directories including hidden directory
. – current
.. – parent
cd <directory>
cd ..
cd /
cd ~
pwd
Change directory
parent directory
root directory
home directory of user
present working directory
man <command>
documentation for all unix commands
if there is : at bottom next page of documentation press <spacebar> to get out of documentation press q
cat <filename>
more <filename>
displays contents of file, scrolls if file is large
display page wise contents of a file
mkdir <directoryname>
mv <filename> <destination_directory>
cp <source_file> <new_file>
cp -R <source_dir> <destination_dir>
create new directory
move a file to another location
wildcards can be used to move multiple files
copy files
copy all files and subdirectories recursively
rm <filename>
rmdir <directory>
rm -R <directory>
There is no recycle bin in unix and file/directory once deleted cannot be recovered
remove a file
wildcards can also be used
remove the directory
Empty directory cannot be removed
remove everything in directory including the directory
ln <source_file> <destination_file>
ln -s <sourc_dir> <destination_dir>
ls <linkeddirectory>
Link file
Deleting a linked file does not delete original file
Link a directory. create a symbolic link
find <wheretofind> -name <whattofind> -print
find <wheretofind> -type d -print
find <wheretofind> -type f –print
find <wheretofind> -size +10M -print
Find a file. Print results on screen
Get all directories
Get all files
Get all files >10MB


Linux Commands Part2


Command
Explanation
history
!<line no>
Get all previous commands
Run a command from history list
chmod <permission> <filename>
Change file/directory permissions
wc <file_name>
wc -w <file_name>
wc -l <file_name>
ls | wc -l
count of lines, count of words, count of characters
count of words
count of lines
count of files in a directory
head <file_name>
tail <file_name>
tail -f <file_name>
first few lines
last few lines
watch last lines of a file as it grows
clear
Clear screen
grep <word> <filename>
grep -c <word> <filename>
grep -i <word> <filename>
grep -v <word> <filename>
grep ^<word> <filename>
grep <word>$ <filename>
grep a. <filename>
grep a* <filename>
grep a[bc] <filename>
Searh a word in file
count of times a word occurs
case insensitive search
lines which do not have the word
line starting with word
line ending with word
. means any character. word a followed with any character
occurrence of a followed with any number of characters
searches for words ab or ac in file
diff <filename1> <filename2>
Compare contents of two files
tar –cvf <tar_file_name> <contents>
tar –tvf <tar_file_name>
tar –xvf <tar_file_name>
Create a tar file
Get list of tar file contents
Extract contents of tar file
env | more
get list of all environment variables
echo $SHELL
echo $PATH
get name of shell
get PATH variable contents
which <command>
Get the location of file for command
ps
Get list of all processes
ps aux | grep <username>
Get list of all process running for all users and then sort the processes for a user
kill <processId>
kill -9 <processId>
Kills a process
Kills a process and all its child processes
vi editor commands
<ctrl>+o
<ctrl>+x
vi <filename>
i
<ESC>
x
:wq
:q
Save
Exit
Open an existing or new file in vi editor
Go to insert mode
Get out of insert mode
Delete a character
Write and quit
Quit




 
 


 
Java Interview Questions
Java Qestions
  1. How do you create an Object instance without using new
    1. Using newInstance method of Class class Eg: Class clas = Class.forName("NewClass"); NewClass obj = (NewClass) clas.newInstance(); - Class.forName() loads the class and to create an object, we need to use newInstance() method of Class class. or using class loader: getClass().getClassLoader().loadClass("NewClass").newInstance();
    2. Using Object Deserialization Eg : ObjectInputStream objStream = new ObjectInputStream(inputStream );
      NewClass obj = (NewClass ) inStream.readObject();
    3. Using clone() of java.lang.Object Eg: NewClass obj = new NewClass();
      NewClass obj2 = obj.clone(); - Creates copy of an existing object

Tuesday, November 4, 2014

Useful blog urls

1.Jenkins or hudson quick start tutorial

2.Setting up subversion on widows

3.Jsp Editor not showing in eclipse

If you've installed Juno EE it should support .jsp editor.
Most probably, your Eclipse is "starting" with java less than v1.6 (for me it was as well, I have 1.3, 1.5, 1.6 javas installed; default was 1.5 and Eclipse was starting with it automatically)
I solved same problem with below way:
1) Right click on Juno shortcut and click Properties
2) In the field "Target"
You already should have something like below:
"D:\PROGRAM INSTALL\eclipse-jee-juno-SR2-win32\eclipse\eclipse.exe"
Add to the end of that line one more command as below (show to Eclipse with which java version it should start)
-vm "C:\Program Files\Java\jdk1.6.0_20\bin\java.exe"
My target looks like below:
"D:\PROGRAM INSTALL\eclipse-jee-juno-SR2-win32\eclipse\eclipse.exe" -vm "C:\Program Files\Java\jdk1.6.0_20\bin\java.exe"
3) Start Eclipse with changed target using your shortcut
4) On .jsp file now you will be able to chose "Open with --> JSP Editor





5.http://www.corejavainterviewquestions.com/idiots-guide-big-o/

6. http://learngitbranching.js.org/



Solr Blog :http://blog.thedigitalgroup.com/dattatrayap/

















Tuesday, September 30, 2014

Oracle Stored Procedure Simple Example


procedure insertValpakCatsMapping(op_company_id IN DISCOUNT_OWNER.COMP_VALPAK_CAT.COMPANYID%type,
            op_category_ids IN common.idlist,
           op_user_id IN DISCOUNT_OWNER.COMP_VALPAK_CAT.ADD_BY_USERID%type)IS
    begin
       delete from discount_owner.COMP_VALPAK_CAT where COMPANYID = op_company_id;
      insert into discount_owner.COMP_VALPAK_CAT
         (companyid,
          VALPAK_CATEGORY_ID,
          add_by_userid,
          change_by_userid)
       select op_company_id,
              catids.column_value,
              op_user_id,
              op_user_id
       from table(cast(op_category_ids as common.idlist)) catids
       minus
       select op_company_id,
              catids.column_value,
              op_user_id,
              op_user_id
       from discount_owner.COMP_VALPAK_CAT  optx, table(cast(op_category_ids as common.idlist)) catids
       where optx.companyid = op_company_id and
             optx.VALPAK_CATEGORY_ID = catids.column_value;
       end;
      

Oracle procedure:passing array to sql procedure from java code

Oracle Side:
step1: create type IDLIST
CREATE OR REPLACE TYPE COMMON."IDLIST"  is table of number ;

Step2: Create proc for inserting a array of categories for a company id

procedure insertValpakCatsMapping(op_company_id IN DISCOUNT_OWNER.COMP_VALPAK_CAT.COMPANYID%type,
            op_category_ids IN common.idlist,
           op_user_id IN DISCOUNT_OWNER.COMP_VALPAK_CAT.ADD_BY_USERID%type)IS
   begin
      insert into discount_owner.COMP_VALPAK_CAT
         (companyid,
          VALPAK_CATEGORY_ID,
          add_by_userid,
          change_by_userid)
       select op_company_id,
              catids.column_value,
              op_user_id,
              op_user_id
       from table(cast(op_category_ids as common.idlist)) catids
       minus
       select op_company_id,
              catids.column_value,
              op_user_id,
              op_user_id
       from discount_owner.COMP_VALPAK_CAT  optx, table(cast(op_category_ids as common.idlist))     catids
       where optx.companyid = op_company_id and
             optx.VALPAK_CATEGORY_ID = catids.column_value;
 end;
      


Java  Calling Code:


Class Test {
    private static ArrayDescriptor _numericDescriptor = null;

public void insertValpakSubcategories(String companyid,
            ArrayList<Integer> cats,long userId)throws SQLException {
       
            Connection conn = null;
            CallableStatement stmt = null;
            ResultSet rs = null;

            try {
              conn = PoolManager.getInstance().getConnection(_pool);
              stmt = conn.prepareCall("{call CMT_COMPANY_PACKAGE.insertValpakCats(?,?,?)}");
              Array categoryIds = createSqlIntegerArray(cats, conn);
              stmt.setString(1,companyid);
              stmt.setArray(2, categoryIds);
              stmt.setLong(3,userId);
              stmt.execute();
              stmt.close();
            }catch(SQLException e){
                LOGGER.error("error in saving subcategories for valpak",e);
                throw e ;
            }
       
    }
   
    public static Array createSqlIntegerArray(ArrayList integerList, Connection conn) {
        if (_numericDescriptor == null) {
            createArrayDescriptors();
        }
        try {
            return new oracle.sql.ARRAY(_numericDescriptor, conn, integerList.toArray());
        }
        catch(SQLException e) {
            LOGGER.error("Error creating sql integer array.", e);
            return null;
        }
    }
   
    private static void createArrayDescriptors() {
        if(_numericDescriptor==null) {
            Connection conn = null;
            try {
                conn = PoolManager.getInstance().getConnection(null);
                _numericDescriptor = ArrayDescriptor.createDescriptor("COMMON.IDLIST", conn);
                _stringDescriptor = ArrayDescriptor.createDescriptor("COMMON.VARLIST", conn);
            } catch(SQLException e) {
                LOGGER.error("Exception creating array descriptors...", e);
            }
            finally {
                cleanUp(conn, null, null);
            }
        }
    }

}

 for more info please read
http://betteratoracle.com/posts/26-passing-arrays-between-java-and-oracle-procedures

Thursday, March 13, 2014

Pass Value from child popup window to parent window at onclick event

1. Parent  Window Code

<form:input path="companyId" id="companyInput" size = "30"/> &nbsp;<input type="button" onclick="popup()" value="Lookup"/></td>

<script>
function popup(){
     window.open('../company/companySearch.html','Company Search','width=600,height=600,resizable=1,scrollbars=yes,top=100,left=100');

}</script>

2. Child Popup Window Code:

Here On click on a link the link value will be returned back to text box in parent window

<a id="compId" href="" onclick ="sendValue(${comp.companyId})"><c:out value="${comp.companyId} "/></a>

<script>
function sendValue(compId){
    window.opener.document.getElementById('companyInput').value=compId;
    window.close();
 }
</script>

Tuesday, February 4, 2014

Web Service Security Using Axis1.4 and WSS4j1.5 for Message signing and Message encryption


Basic Signing and Encryption Scenario:

Overview

The scenario described here is a client-server application, where an asymmetric binding policy is set up to encrypt and sign the SOAP body of messages that pass back and forth between the client and the server.
Example scenario
Below shows an overview of the basic signing and encryption scenario, which is specified by associating an asymmetric binding policy with an endpoint in the WSDL contract.

Figure 1.1. Basic Signing and Encryption Scenario
WS-Security Message Signing and Encryption








Scenario steps
When the client in Figure 1.1 invokes a synchronous operation on the recipient's endpoint, the request and reply message are processed as follows:
  1. As the outgoing request message passes through the WS-SecurityPolicy handler, the handler processes the message in accordance with the policies specified in the client’s asymmetric binding policy. In this example, the handler performs the following processing:
    1. Encrypt the SOAP body of the message using Bob’s public key.
    2. Sign the encrypted SOAP body using Alice’s private key.
  2. As the incoming request message passes through the server's WS-SecurityPolicy handler, the handler processes the message in accordance with the policies specified in the server’s asymmetric binding policy. In this example, the handler performs the following processing:
    1. Verify the signature using Alice’s public key.
    2. Decrypt the SOAP body using Bob’s private key.
  3. As the outgoing reply message passes back through the server's WS-SecurityPolicy handler, the handler performs the following processing:
    1. Encrypt the SOAP body of the message using Alice’s public key.
    2. Sign the encrypted SOAP body using Bob’s private key.
  4. As the incoming reply message passes back through the client's WS-SecurityPolicy handler, the handler performs the following processing:
    1. Verify the signature using Bob’s public key.
    2. Decrypt the SOAP body using Alice’s private key.


Using Axis1.4 and WSS4j for message signature and Encryption

Server Side:

Required Third Party Jars: xalan-2.7.1.jar, xmlsec-1.4.5.jar, wss4j-1.5.12.jar and Axis1.4 jar files
Put all these files in your web application’s lib directory

Step1:
We need to create a public private key pair for message signing and encryption, We can use Java keytool for generating key store and keys using below commands
Below command  will create a file called server.keystore which contains a private and public key pair for encryption purpose. Make sure your java path is set and java home also set.
Go to command prompt, go to c:\ and some folder where you want to create your keystore like test
type below command with your own argument.
       a)       C:\test>  keytool -genkey -dname "CN=Server,OU=Encryption, O=Mycompany, L=Newyork, S=CT, C=US" -alias serverkey -keypass Welcome1 -validity 9999 -keyalg RSA -sigalg SHA1withRSA -keystore server.keystore -storepass Welcome1

explaination :where CN->Common Name,OU->Organisational Unit,0->Organisation,L->location,S->State,C->Country Code
keyalg-Key Alogrthim
sigalg-Signature Algorthim
keystore-keystorename
storepass-keystores password
keypass-Key password
validity-key Validity in days
-dname-distinguied name
b) This will create a file called client.keystore that contains a key pair for message signing. use your own arguments

keytool -genkey -dname "CN=Client, OU=Signing, O=Mycompany, L=NewYork, S=CT, C=US" -alias clientkey -keypass Welcome1 -validity 9999 -keyalg RSA -sigalg SHA1withRSA -keystore client.keystore -storepass Welcome1

c) .In order for the client to trust the server, we need to export the public key from server.keystore and import it to client.keystore:

keytool -export -alias serverkey -keystore server.keystore -storepass Welcome1 -file servercert.cer
keytool -import -alias serverkey -keystore client.keystore -storepass Welcome1 -file servercert.cer
d) In order for the server to trust the client, we need to export the public key from client.keystore and import it to server.keystore:

keytool -export -alias clientkey -keystore client.keystore -storepass Welcome1 -file clientcert.cer

keytool -import -alias clientkey -keystore server.keystore -storepass Welcome1 -file clientcert.cer


Step2: Update  server-config.wsdd of existing webservice located under WEB-INF directory
Add the highlighted code in the server-config.wsdd for your existing service here my existing service is UserSoap
see below I added the code in yelow to server-config.wsdd
<ns1:service name="UserSoap" provider="java:RPC" style="wrapped" use="literal">
  <ns3:operation name="changePassword" qname="ns1:changePassword" returnQName="ns1:changePasswordReturn" returnType="ns2:UserBean" soapAction="" xmlns:ns1="http://user.services.soap.lcc.mycompany.com" xmlns:ns2="http://beans.user.services.soap.lcc.mycompany.com" xmlns:ns3="http://xml.apache.org/axis/wsdd/">
   <ns3:parameter qname="ns1:newPassword" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   <ns3:parameter qname="ns1:userId" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   <ns3:parameter qname="ns1:oldPassword" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   <ns3:parameter qname="ns1:retypePassword" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   <ns3:parameter qname="ns1:profile_chgpwd" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   <ns3:parameter qname="ns1:last_pwdchg" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
   <ns3:parameter qname="ns1:submission" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
  </ns3:operation>
  <ns1:requestFlow>
            <ns1:handler type="java:org.apache.ws.axis.security.WSDoAllReceiver">
            <ns1:parameter name="passwordCallbackClass" value="com.mycompany.lcc.soap.services.user.ChangePasswordCallBackHandler"/>
                <ns1:parameter name="action" value="Signature Encrypt"/>
                <ns1:parameter name="signaturePropFile" value="crypto.properties" />
                <parameter name="decryptionPropFile" value="crypto.properties" />
                <parameter name="encryptionPropFile" value="crypto.properties" />
            </ns1:handler>
   </ns1:requestFlow>
  <ns1:parameter name="allowedMethods" value="changePassword"/>
  <ns1:parameter name="typeMappingVersion" value="1.2"/>
  <ns1:parameter name="wsdlPortType" value="UserSoap"/>
  <ns1:parameter name="className" value="com.mycompany.lcc.soap.services.user.UserSoap"/>
  <ns1:parameter name="wsdlServicePort" value="UserSoap"/>
  <ns1:parameter name="schemaQualified" value="http://beans.user.services.soap.lcc.mycompany.com,http://user.services.soap.lcc.mycompany.com"/>
  <ns1:parameter name="wsdlTargetNamespace" value="http://user.services.soap.lcc.mycompany.com"/>
  <ns1:parameter name="wsdlServiceElement" value="UserSoapService"/>
  <ns1:typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns3:UserBean" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.mycompany.lcc.soap.services.user.beans.UserBean" xmlns:ns3="http://beans.user.services.soap.lcc.mycompany.com"/>
 </ns1:service>
step3: Create a callback handler on server

package com.mycompany.lcc.soap.services.user;

import java.io.IOException;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

import org.apache.ws.security.WSPasswordCallback;

public class ChangePasswordCallBackHandler implements  CallbackHandler{

                @Override
                public void handle(Callback[] callbacks) throws IOException,
                                                UnsupportedCallbackException {
                                for (int i = 0; i < callbacks.length; i++) {
            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
            String id = pwcb.getIdentifier();
            int usage = pwcb.getUsage();
            if (usage == WSPasswordCallback.DECRYPT || usage == WSPasswordCallback.SIGNATURE) {
                // used to retrieve password for private key
                if ("serverkey".equals(id)) {
                    pwcb.setPassword("Welcome1");
                }
                else if ("clientkey".equals(id)) {
                    pwcb.setPassword("Welcome1");
                }
            }
         }
    }         
                }
Put above class  inside classes or in classpath of weaplication
               
Step4:  Copy server.keystore file created in step 1a to WEB-INF/Classes directory
Step5: Create a property file named crypto.properties inside classes directory
Copy below code to crypto.properties
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=Welcome1
org.apache.ws.security.crypto.merlin.keystore.alias=serverkey
org.apache.ws.security.crypto.merlin.file=server.keystore

Step6 : Restart the tomcat Server,web service security with message encryption and signing is applied.

Client Side: Stand Alone Client:

Jars required: Required Third Party Jars: xalan-2.7.1.jar, xmlsec-1.4.5.jar, wss4j-1.5.12.jar and Axis1.4 jar files

Assumption: Webservice client Code is already generated using wsdl file
Step1: Copy the client.keystore file from Server Side Step 1b  to the root path of your client project.
Step2:Create a crypto.properties file and copy below code to it and put it  to the root class path
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=Welcome1
org.apache.ws.security.crypto.merlin.keystore.alias=clientkey
org.apache.ws.security.crypto.merlin.file=client.keystore

Step3: Create a wsdd file called client_deploy.wsdd and copy it to the root class path
Contents of the wsdd file given below
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
    <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender" />
    <globalConfiguration>
        <requestFlow>
            <handler type="java:org.apache.ws.axis.security.WSDoAllSender">
                <parameter name="user" value="clientkey" />

                <parameter name="encryptionUser" value="serverkey"/>
                <parameter name="action" value="Signature Encrypt" />
                <parameter name="signaturePropFile" value="crypto.properties" />
                <parameter name="encryptionPropFile" value="crypto.properties" />
                <parameter name="passwordCallbackClass" value="com.ChangePwdClientCallBackHandler" />
               
            </handler>
           
    </globalConfiguration>
 </deployment>

Step4: Add the below Handler class to your client code
package com;

import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.ws.security.WSPasswordCallback;

public class ChangePwdClientCallBackHandler implements CallbackHandler {

                @Override
                public void handle(Callback[] callbacks) throws IOException,
                                                UnsupportedCallbackException {
                               
                                System.out.println("Inside Handler");
                                for (int i = 0; i < callbacks.length; i++) {
            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
            String id = pwcb.getIdentifier();
            int usage = pwcb.getUsage();
            if (usage == WSPasswordCallback.DECRYPT || usage == WSPasswordCallback.SIGNATURE) {
                // used to retrieve password for private key
                if ("clientkey".equals(id)) {
                    pwcb.setPassword("Welcome1");
                   
                }
            }
        }
                               
                }
}

Step 5: Add the path to configuration(wsdd file) in your existing  web service calling code


package com;

import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

import org.apache.axis.EngineConfiguration;
import org.apache.axis.configuration.FileProvider;

import com.mycompany.lcc.soap.services.user.UserSoap;
import com.mycompany.lcc.soap.services.user.UserSoapServiceLocator;
import com.mycompany.lcc.soap.services.user.beans.UserBean;

public class CpClient {
               
public static void main(String[] args) throws ServiceException ,RemoteException, MalformedURLException, FileNotFoundException{
                //System.setProperty("axis.ClientConfigFile", "client_deploy.wsdd");
               
     //Give relative path to wsdd file
                EngineConfiguration config = new FileProvider("./client_deploy.wsdd");
                UserSoapServiceLocator sl= new UserSoapServiceLocator(config);
                                UserSoap us = sl.getUserSoap(new java.net.URL("http://localhost:8080/services/UserSoap"));

//calling webservice method                             
UserBean u = us.changePassword("Test12345", "43243", "Test1234", "Test12345");
                System.out.println("isSuccess:"+u.getServiceSuccess());
                System.out.println("Error mesg: "+u.getErrorMsg());
                System.out.println("Success msg: "+u.getSuccessMsg());
}
}





Web Service Client User Guide for calling webservice inside  Web Application 
Running  client using  Axis1.4
A jar file containing all the java classes needed to call Axis1.4 web service  will be provided to end user
For Example- suppose this file name is ChangePasswordClient.jar

Steps to use in standalone/web project:
1-       Configure build path of project  and set ChangePasswordClient.jar  in class path as External  Jar in eclipse
2    Jar files required for writing simple Axis1.4 Client  
       Set below jar files in class path as external jars in eclipse
axis.jar
commons-discovery-0.2.jar
commons-logging.jar
jaxrpc.jar
saaj.jar
wsdl4j.jar
    Required Jars  for security : xalan-2.7.1.jar, xmlsec-1.4.5.jar, wss4j-1.5.12.jar 
3-       Create Java class and  call the webservice
Ex-


package com;

import java.net.MalformedURLException;
import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

import com.mycompany.lcc.soap.services.user.UserSoap;
import com.mycompany.lcc.soap.services.user.UserSoapServiceLocator;
import com.mycompany.lcc.soap.services.user.beans.UserBean;

public class CPClient {
               
public static void main(String[] args)throws ServiceException ,RemoteException, MalformedURLException {
                               

EngineConfiguration config = new FileProvider("./client_deploy.wsdd");
                UserSoapServiceLocator sl= new UserSoapServiceLocator(config);
                System.out.println("test1");
                UserSoap us = sl.getUserSoap(new java.net.URL("http://localhost:8080/services/UserSoap"));
                                System.out.println("test2");
                //calling webservice method
                UserBean u = us.changePassword("Test12345", "14936079", "Test1234", "Test12345", null, null,null);
                System.out.println("isSuccess:"+u.getServiceSuccess());
                System.out.println("Error mesg: "+u.getErrorMsg());
                System.out.println("Success msg: "+u.getSuccessMsg());
                }

}

above code can be called from inside a servlet or POJO