permaculture playing cards*
The moose likes Web Services and the fly likes Issue with Web Service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Issue with Web Service" Watch "Issue with Web Service" New topic

Issue with Web Service

Supraja Kannaiyan
Ranch Hand

Joined: Mar 09, 2007
Posts: 41

I have developed a web service using Tomcat and Axis. I have used the return type for the method exposed in web Service as Array of Beans. Now I am not able to retrieve the array of Beans in my client code. Please help me.

Sai Swami
Ranch Hand

Joined: Sep 24, 2002
Posts: 51

Can you post your client code ?

Supraja Kannaiyan
Ranch Hand

Joined: Mar 09, 2007
Posts: 41
ackage com;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import java.lang.reflect.*;
import mypackage.Employee;

public class EmployeeClient
public static void main(String [] args)
try {
Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress( new"http://localhost:8080/TestWebServices/services/EmployeeWebService") );
call.setOperationName( new QName("http://mypackage", "getAllEmployees") );
QName qn = new QName( "{urn:myPackage}Employee", "Employee" );
call.registerTypeMapping(Employee.class, qn,new org.apache.axis.encoding.ser.BeanSerializerFactory(Employee.class, qn),new org.apache.axis.encoding.ser.BeanDeserializerFactory(Employee.class,qn));
call.setReturnType( org.apache.axis.encoding.XMLType.XSD_ANYTYPE);

Employee ret = (Employee) call.invoke(new Object[]{} );

System.out.println("Length Of the Array : " + ret.getName());
} catch (Exception e) {
It is sorta covered in the JavaRanch Style Guide.
subject: Issue with Web Service
Similar Threads
Stateful Session Beans CAN be used as web services
Service Locator
Array of user defined type
How to extract and print the contents of arraylist of java bean objects?
Axis Soap Responses