Hello,
I have a test web service with following methods & classes,
Method
public String addPerson(Person p) {
if(p instanceof Employee) {
return "Employee";
}
return "Person";
}
Note: Method is annotated with @WebMethod, @WebParam annotations, so is web service with @WebService.
Classes
Class Person {
public String name;
}
Class Employee extends Person{
public int employeeNo;
}
Observations
- In spite of client sending the serialized Employee object the web service is always taking it as a Person object. I have checked the soap packet on client with firebug tool, employee number is present in the payload. I also check soap MESSAGE on server & their I dont see employee number attribute.
Question
- Is this an expected behavior? I hope it is not.
- Is there any way I can make this work without having write custom SOAP decoders?