aspose file tools
The moose likes Web Services Certification (SCDJWS/OCPJWSD) and the fly likes Web Services Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCPJWSD)
Reply Bookmark "Web Services" Watch "Web Services" New topic
Author

Web Services

Supraja Kannaiyan
Ranch Hand

Joined: Mar 09, 2007
Posts: 41
Hi,

I am trying to develop Web services using Tomcat and Apache Axis. I would like to Know how to pass Java Bean as input and output from the web service. Please send me some source code if you have any.

Thanks in Advance,
Supraja
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
Check out the "pojo" sample code that comes with Axis. It demonstrates how to send a JavaBean in a SOAP call.


Android appsImageJ pluginsJava web charts
Supraja Kannaiyan
Ranch Hand

Joined: Mar 09, 2007
Posts: 41
Hi,

Thanks for your Reply. But I am finding some problem when executing that code. Please provide me with some code samples for passing JavaBean as input and output from the client Program.

Thanks,
Supraja
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
What kind of problem? TellTheDetails
Supraja Kannaiyan
Ranch Hand

Joined: Mar 09, 2007
Posts: 41
I am getting this Exception

[b]Deserializing parameter 'getAllEmployeesReturn': could not find deserializer for type {urn:mypackage}Employee[/b]

My Client COde is

package 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.name);
} catch (Exception e) {
e.printStackTrace();
}
}
}

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Web Services
 
Similar Threads
benefits of web services certification
passed 81 %
Technologies which have a good scope
[Doug Dunn] Web Services.
Communication of servlets in different JVM's