This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Web Services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
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: 39547
    
  27
Check out the "pojo" sample code that comes with Axis. It demonstrates how to send a JavaBean in a SOAP call.


Ping & DNS - updated with new look and Ping home screen widget
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: 39547
    
  27
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://aspose.com/file-tools
 
subject: Web Services
 
Similar Threads
[Doug Dunn] Web Services.
Communication of servlets in different JVM's
Technologies which have a good scope
passed 81 %
benefits of web services certification