File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 42

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: 42
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) {
I agree. Here's the link:
subject: Issue with Web Service
It's not a secret anymore!