I generated a Dynamic Web Project in Eclipse with the target runtime Apache Tomcat v8.0 and Dynamic web module version 3.1 and Default Configuration for Apache Tomcat v8.0.
I wrote the following Java class:
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Account implements Serializable {
@XmlElement(name="InternalId")
public String InternalId;
@XmlElement(name="FirstLineName")
public String FirstLineName;
@XmlElement(name="MatchCode", required=false)
public String MatchCode;
@XmlElement(name="contacts", required=false)
public Contact[] contacts;
@Override
public String toString() {
String text = "InternalId <" + InternalId +
"> FirstLineName <" + FirstLineName +
"> MatchCode <" + MatchCode + ">\n";
for(Contact c : contacts) {
text = text + "contact " + c.toString() + "\n";
}
return text;
}
}
If I am going to create the WebService the wsdl generated looks like:
<complexType name="Account">
<sequence>
<element name="InternalId" nillable="true" type="xsd:string"/>
<element name="FirstLineName" nillable="true" type="xsd:string"/>
<element name="MatchCode" nillable="true" type="xsd:string"/>
<element name="contacts" nillable="true" type="impl:ArrayOfContact"/>
</sequence>
</complexType>
The match code is not required, so there should be something like minOccurs="1"
Kind Regards, Lukas
Aucun commentaire:
Enregistrer un commentaire