This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with Web Service

 
Supraja Kannaiyan
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can you post your client code ?

-Sai
 
Supraja Kannaiyan
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
}
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic