DZone Forums
Go Back   DZone Forums > Community > Enterprise Development > Web Services, SOA & ESB
Reload this Page need help with simple web service client code using Axis2
Notices
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Dec 2009
Unhappy need help with simple web service client code using Axis2 - 01-02-2010, 06:01 AM

Hi,
i am trying to create a web service and its client using axis2 1.3 , tomcat 5.5 and eclipse 3.4 and mySql.
i have creates service class have few methods in it. and created web service using the eclipse . after creating web service i have created one
client program to call my web service . its a simple database operation . i am calling a method to register new employee.
my client is able to hit the service but not inserting record in database and returning a false response.
any idea why this may happen ?
i am listing my service class and client class below .. please help ...


service class -----
Code:
public class EmployeeService
 {

	/**
	 * String lgn --- Employee Login
	 * String Nam --- Employee Name
	 * String Pass --- Employee Password
	 * int Acod --- Employee Authorisation code
	 */
	public boolean registerEmployee(String Lgn, String Nam, String Pass,int Acod) { 
		DBOperations DBO = new DBOperations();
		try {
			DBO.OpenDBConection();
			DBO.executeQuery("INSERT INTO employee (login,name,pass,acode) Values('"
							+ Lgn.trim()+ "','"
							+ Nam+ "','"
							+ Pass+ "',"
							+ Acod + ")");
			DBO.closeDBConnection();
			return true;        // i should get this true ... 
		} catch (Exception e) {
			e.printStackTrace();
			return false;    /// my client code is always giving me this flase value .. no idea why ...it seems some exception.. but what
		}
	}
	
}

client code here --------
Code:
package webservice;

import java.rmi.RemoteException;

import org.apache.axis2.AxisFault;

import webservice.EmployeeServiceStub.RegisterEmployee;
import webservice.EmployeeServiceStub.RegisterEmployeeResponse;

public class EmployeeClient {

	public static void main(String[] args)   {
		
		EmployeeServiceStub employeeServiceStub;
		try {
			employeeServiceStub = new EmployeeServiceStub();
			RegisterEmployee registerEmployee3 = new RegisterEmployee() ;
			registerEmployee3.setAcod(8888);
			registerEmployee3.setLgn("ryank");
			registerEmployee3.setNam("Ryan");
			registerEmployee3.setPass("london");
			RegisterEmployeeResponse response = employeeServiceStub.registerEmployee(registerEmployee3);
			System.out.println("Response ..."+response.get_return());
			System.out.println("Employee registered ...");
						
		} catch (AxisFault e) {
			e.printStackTrace();
		} catch (RemoteException e) {
			e.printStackTrace();
		}
			}
	
}
Reply With Quote
  (#2 (permalink)) Old
Member
 
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Dec 2009
Default 01-02-2010, 06:22 AM

i saw that it is giving this below error but not sure why ??

org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method registerEmployee
at org.apache.axis2.util.Utils.getInboundFaultFromMes sageContext(Utils.java:486)
at org.apache.axis2.description.OutInAxisOperationCli ent.handleResponse(OutInAxisOperation.java:343)
at org.apache.axis2.description.OutInAxisOperationCli ent.send(OutInAxisOperation.java:389)
at org.apache.axis2.description.OutInAxisOperationCli ent.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(Op erationClient.java:163)
at webservice.EmployeeServiceStub.registerEmployee(Em ployeeServiceStub.java:488)
at webservice.EmployeeClient.main(EmployeeClient.java :22)

can anyone suggest why this might come ?
thanks
Reply With Quote
  (#3 (permalink)) Old
Member
 
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Dec 2009
Default 01-02-2010, 06:22 AM

i saw that it is giving this below error but not sure why ??

org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method registerEmployee
at org.apache.axis2.util.Utils.getInboundFaultFromMes sageContext(Utils.java:486)
at org.apache.axis2.description.OutInAxisOperationCli ent.handleResponse(OutInAxisOperation.java:343)
at org.apache.axis2.description.OutInAxisOperationCli ent.send(OutInAxisOperation.java:389)
at org.apache.axis2.description.OutInAxisOperationCli ent.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(Op erationClient.java:163)
at webservice.EmployeeServiceStub.registerEmployee(Em ployeeServiceStub.java:488)
at webservice.EmployeeClient.main(EmployeeClient.java :22)

can anyone suggest why this might come ?
thanks
Reply With Quote
Reply

Tags
axis2, eclipse, web services

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem while invoking web service through code ashu47202 Java 4 10-09-2009 12:57 PM
How can I be passing values from JSP to a web service client? mobzam Web Services, SOA & ESB 0 10-05-2009 03:22 AM
Simple Hit counter peter_rodrick PHP 2 03-27-2009 02:04 PM
Can't install Axis2 Code Gen plugin on Mac Tom Bates Eclipse 1 01-27-2009 03:58 PM
Axis2 implementation error (status 404) yanhua Eclipse 0 02-20-2008 09:26 AM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com