Answer the question
In order to leave comments, you need to log in
How to screw together a JAX-WS web service and @XmlAnyElement?
I'm developing a SOAP @WebService using Spring and JAX-WS 2.2.10.
I will give the class code that describes part of the input parameter to the web service function:
package com.itu.messaging.regional;
import org.w3c.dom.Element;
import javax.xml.bind.annotation.*;
import java.io.Serializable;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "GenericMessagePrimaryContent", propOrder = {
"any"
})
public class GenericMessagePrimaryContent implements Serializable {
@XmlAnyElement
protected Element any;
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Element }
*
*/
public Element getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Element }
*
*/
public void setAny(Element value) {
this.any = value;
}
}
java.lang.ClassCastException: com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$26 cannot be cast to com.sun.xml.bind.v2.model.core.EnumLeafInfo.
Answer the question
In order to leave comments, you need to log in
In the end, everything turned out to be simpler, although it is still incomprehensible.
Moved all classes containing @XmlAnyElement to another package and, as a result, another XML-namespace, in relation to the @XmlRootElement classes.
And everything started up, wsdl was generated and works without problems. Some kind of magic.
Typically, application servers already contain libraries to support web services. Your application probably also contains some of these libraries, or dependencies.
Try to deploy a "clean" application server, from scratch. Then deploy your application, but remove all libraries from it, or better yet, leave only the web service class and web.xml in general. If the web service deploys in this configuration, then add the necessary libraries (maven dependencies) one by one, rebuild and deploy again, until the error repeats. So you will understand which library is conflicting. Probably, it will need to be removed from dependencies, or specified as Provided.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question