aspose file tools*
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
Author

Issue with Web Service

Supraja Kannaiyan
Ranch Hand

Joined: Mar 09, 2007
Posts: 41
Hi,

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.

Thanks,
Supraja
Sai Swami
Ranch Hand

Joined: Sep 24, 2002
Posts: 51
Hi,

Can you post your client code ?

-Sai
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 java.net.URL("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) {
e.printStackTrace();
}
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue with Web Service
 
Similar Threads
Service Locator
Axis Soap Responses
Array of user defined type
Stateful Session Beans CAN be used as web services
How to extract and print the contents of arraylist of java bean objects?