When returning an object that is already annotated with JaxB annotations the generated Client classes using wsimport via Netbeans has the objects nested within the root element class. If the JaxB annotations do not exist for the returned object the resulting object and objects contained inside are not nested together. What are the necessary switches to get wsimport to not generate the nested classes?
Client Generated code of a JaxB returned Object:
package test;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Narrative">
* <complexType>
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>string">
* <attribute name="Modified" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="UserID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </extension>
* </simpleContent>
* </complexType>
* </element>
* </sequence>
* <attribute name="DataFuse" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="Version" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="Validation" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="Code" type="{http://www.w3.org/2001/XMLSchema}int" />
* <attribute name="Message" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"narrative"
})
@XmlRootElement(name = "WorkFlowSettings")
public class WorkFlowSettings {
@XmlElement(name = "Narrative", required = true)
protected WorkFlowSettings.Narrative narrative;
@XmlAttribute(name = "DataFuse", required = true)
protected String dataFuse;
@XmlAttribute(name = "Version", required = true)
protected String version;
@XmlAttribute(name = "Validation", required = true)
protected String validation;
@XmlAttribute(name = "Code")
protected Integer code;
@XmlAttribute(name = "Message")
protected String message;
/**
* Gets the value of the narrative property.
*
* @return
* possible object is
* {@link WorkFlowSettings.Narrative }
*
*/
public WorkFlowSettings.Narrative getNarrative() {
return narrative;
}
/**
* Sets the value of the narrative property.
*
* @param value
* allowed object is
* {@link WorkFlowSettings.Narrative }
*
*/
public void setNarrative(WorkFlowSettings.Narrative value) {
this.narrative = value;
}
/**
* Gets the value of the dataFuse property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDataFuse() {
return dataFuse;
}
/**
* Sets the value of the dataFuse property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDataFuse(String value) {
this.dataFuse = value;
}
/**
* Gets the value of the version property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVersion() {
return version;
}
/**
* Sets the value of the version property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVersion(String value) {
this.version = value;
}
/**
* Gets the value of the validation property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValidation() {
return validation;
}
/**
* Sets the value of the validation property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValidation(String value) {
this.validation = value;
}
/**
* Gets the value of the code property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getCode() {
return code;
}
/**
* Sets the value of the code property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setCode(Integer value) {
this.code = value;
}
/**
* Gets the value of the message property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMessage() {
return message;
}
/**
* Sets the value of the message property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMessage(String value) {
this.message = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>string">
* <attribute name="Modified" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="UserID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"value"
})
public static class Narrative {
@XmlValue
protected String value;
@XmlAttribute(name = "Modified", required = true)
protected String modified;
@XmlAttribute(name = "UserID", required = true)
protected String userID;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the modified property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getModified() {
return modified;
}
/**
* Sets the value of the modified property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setModified(String value) {
this.modified = value;
}
/**
* Gets the value of the userID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserID() {
return userID;
}
/**
* Sets the value of the userID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserID(String value) {
this.userID = value;
}
}
}
Client Generated code from a non-JaxB Object:
package test;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for noJaxBWorkFlowSettings complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="noJaxBWorkFlowSettings">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="code" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* <element name="dataFuse" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="narrative" type="{http://test/}noJaxBNarrative" minOccurs="0"/>
* <element name="validation" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="version" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "noJaxBWorkFlowSettings", propOrder = {
"code",
"dataFuse",
"message",
"narrative",
"validation",
"version"
})
public class NoJaxBWorkFlowSettings {
protected Integer code;
protected String dataFuse;
protected String message;
protected NoJaxBNarrative narrative;
protected String validation;
protected String version;
/**
* Gets the value of the code property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getCode() {
return code;
}
/**
* Sets the value of the code property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setCode(Integer value) {
this.code = value;
}
/**
* Gets the value of the dataFuse property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDataFuse() {
return dataFuse;
}
/**
* Sets the value of the dataFuse property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDataFuse(String value) {
this.dataFuse = value;
}
/**
* Gets the value of the message property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMessage() {
return message;
}
/**
* Sets the value of the message property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMessage(String value) {
this.message = value;
}
/**
* Gets the value of the narrative property.
*
* @return
* possible object is
* {@link NoJaxBNarrative }
*
*/
public NoJaxBNarrative getNarrative() {
return narrative;
}
/**
* Sets the value of the narrative property.
*
* @param value
* allowed object is
* {@link NoJaxBNarrative }
*
*/
public void setNarrative(NoJaxBNarrative value) {
this.narrative = value;
}
/**
* Gets the value of the validation property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValidation() {
return validation;
}
/**
* Sets the value of the validation property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValidation(String value) {
this.validation = value;
}
/**
* Gets the value of the version property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVersion() {
return version;
}
/**
* Sets the value of the version property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVersion(String value) {
this.version = value;
}
}
package test;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for noJaxBNarrative complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="noJaxBNarrative">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="modified" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="userID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "noJaxBNarrative", propOrder = {
"modified",
"userID",
"value"
})
public class NoJaxBNarrative {
protected String modified;
protected String userID;
protected String value;
/**
* Gets the value of the modified property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getModified() {
return modified;
}
/**
* Sets the value of the modified property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setModified(String value) {
this.modified = value;
}
/**
* Gets the value of the userID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserID() {
return userID;
}
/**
* Sets the value of the userID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserID(String value) {
this.userID = value;
}
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
}
Scott Selvia
(O) 813.960.7800 x102
(F) 813.960.7811
http://www.datamentors.com
