So, I try to write SOAP @WebService with Spring and JAX-WS 2.2.10.
Part of incoming function parameter looks like this:
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;
}
}
But, when I deploy my code (and want to see generated WSDL) - I got this exception: java.lang.ClassCastException: com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$26 cannot be cast to com.sun.xml.bind.v2.model.core.EnumLeafInfo
.
So, the most interesting is, that exception throws in XmlSchemaGenerator.java
, but not JAX-WS XmlSchemaGenerator, in Glassfish Metro 2.3.1 XmlSchemaGenerator.java
.
My project has a lot of modules, but this module don't have link to metro in his pom.xml, it has only another module. Why this problem can become?
So, answer is simple and strange.
All my @XmlType classes was in one java package and in one XML-namespace.
So, when I moved @XmlType classes, which contains @XmlAnyElement to another java package and XML-namespace, but all @XmlRootElement classes still stay in first package and namespace - all started working well. Strange, sad, but true.
P.S. I think, this is a bug in JAX-WS.