Hi axis list!
I'm new with axis and I've a problem with deserialization.
I have a method which return an Object Employee which is a bean.
The code of the class Employee is:
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
public class Employee{
private String name;
private String login;
private String pwd;
public static final QName QNAME = new QName(
"http://localhost:8080/axis/", "Employee");
public Employee(String name, String login, String pwd){
this.name = name;
this.login = login;
this.pwd = pwd;
}
public Employee(){
this("","","");
}
//getters and setters
public static void registerTypeMapping(Call call) {
call.registerTypeMapping(Employee.class, QNAME,
new BeanSerializerFactory(Employee.class, QNAME),
new BeanDeserializerFactory(Employee.class, QNAME));
}
}
I've the bean mapping for this class in the wsdd:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<beanMapping qname="ns:local" xmlns:ns="Employee"
type="java:business.Employee"
encodingStyle="http://schema.xmlsoap.org/soap/encoding/" />
<service name="EmployeeService" style="RPC">
<parameter name="className" value="business.Bank"/>
<parameter name="allowedMethods" value="login addEmployee"/>
<parameter name="scope" value=" application "/>
</service>
</deployment>
And my client code (a test) is the following one:
import org.apache.axis.client.*;
import javax.xml.namespace.*;
import java.net.URL;
import business.Employee;
public class Client {
public static void main(String []params){
try{
Service service = new Service();
Call call = (Call)service.createCall();
URL url = new
URL("http://localhost:8080/axis/services/EmployeeService");
call.setTargetEndpointAddress(url);
QName qname = new QName("http://localhost:8080/axis/","Employee");
call.setOperationName(new QName("","login"));
call.registerTypeMapping(Employee.class, Employee.QNAME,
new
org.apache.axis.encoding.ser.BeanSerializerFactory(Employee.class, qname),
new
org.apache.axis.encoding.ser.BeanDeserializerFactory(Employee.class,
qname));
Employee e = (Employee)call.invoke(new Object[]{"alis", "toto"});
System.out.println("output id:"+e.getName());
}catch (Exception e){
System.err.println(e.toString());
}
}
}
when I launch my client I have this message:
- Unable to find required classes (javax.activation.DataHandler and
javax.mail.internet.MimeMultipart). Attachment support is disabled.
- Exception:
org.xml.sax.SAXException: Deserializing parameter 'loginReturn': could
not find deserializer for type {Employee}local
at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
at
org.apache.axis.encoding.DeserializationContext.startElement(
DeserializationContext.java:1035)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java
:1141)
at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at Client.main(Client.java:26)
org.xml.sax.SAXException: Deserializing parameter 'loginReturn': could
not find deserializer for type {Employee}local
thank you for your helping.
regards,
--
Guillaume Erétéo