I have this simple JAX-WS WebService:

@WebService
public class AnimalFeedingService {
    @WebMethod
    public void feed(@WebParam(name = "animal") Animal animal) {
        // Whatever
    }
}

@XmlSeeAlso({ Dog.class, Cat.class })
public abstract class Animal {
    private double weight;
    private String name;
    // Also getters and setters
}

public class Dog extends Animal {}

public class Cat extends Animal {}

I create a client and call feed with an instance of Dog.

Animal myDog = new Dog();
myDog .setName("Rambo");
myDog .setWeight(15);
feedingServicePort.feed(myDog);

The animal in the body of the SOAP call looks like this:

<animal>
    <name>Rambo</name>
    <weight>15</weight>
</animal>

and I get an UnmarshallException because Animal is abstract.

Is there a way to have Rambo unmarshalled as an instance of class Dog? What are my alternatives?

Edit
Report