Я не получаю ответ от веб-службы, когда XMLElement находится внутри типа ответа
Я попытался удалить элемент XML под типом ответа и штраф веб-службы нормально.Однако, как только я держу элемент XML внутри типа ответа веб-службы, служба не отвечает, и я просто получаю сообщение об ошибке тайм-аута.Это означает, что сервер не может понять, как понять тип ответа?Я делаю что-то не так с аннотациями?Я не мог найти причину проблемы.Я пытался держать класс Item внутри класса Root, а также снаружи.Нет ответа.
ResponseType и базовые типы элементов:
@XmlAccessorType(XmlAccessType.FIELD)
public class InterpreterResponse {
@XmlElement
protected Root root;
@XmlAttribute
protected String message;
public Root getRoot() {
return root;
}
public void setRoot(Root root) {
this.Root = root;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
public class Root {
@XmlElement
List<Item> item;
public List<Item> getItem() {
if (item == null) {
item = new ArrayList<>();
}
return item;
}
public void setItem(List<Item> items) {
item = items;
}
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
public static class Item {
@XmlAttribute
String id;
@XmlAttribute
String appId;
@XmlAttribute
String parentAppId;
@XmlAttribute
String navtitle;
public String getId() {
return id != null ? id : "";
}
public void setId(String id) {
this.id = id;
}
public String getappId() {
return appId != null ? appId : "";
}
public void setappId(String appId) {
this.appId = appId;
}
public String getParentappId() {
return parentAppId != null ? parentAppId : "";
}
public void setParentappId(String parentAppId) {
this.parentAppId = parentAppId;
}
public String getNavtitle() {
return navtitle != null ? navtitle : "";
}
public void setNavtitle(String navtitle) {
this.navtitle = navtitle;
}
}
}
В реализации конечной точки:
InterpreterResponse response = new InterpreterResponse();
Root root = new Root();
for (...) {
Item item = new Item();
item.setId("id");
...
root.getItem().add(item);
}
response.setRoot(root);
return response;
Файл и схема WSDL, похоже, генерируются простохорошо:
<operation name="Interpreter">
<input message="tns:Interpreter" wsam:Action=".../InterpreterRequest"> </input>
<output message="tns:InterpreterResponse" wsam:Action=".../InterpreterResponse"> </output>
<fault name="javalinkException" message="tns:javalinkException" wsam:Action=".../javalinkException"> </fault>
</operation>
Схема:
<xs:complexType name="InterpreterResponse">
<xs:complexContent>
<xs:sequence>
<xs:element name="root" type="ns1:root" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="message" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="root">
<xs:sequence>
<xs:element name="item" type="tns:item" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="item">
<xs:sequence>
<xs:element name="id" type="xs:string" minOccurs="0"/>
<xs:element name="navtitle" type="xs:string" minOccurs="0"/>
<xs:element name="parentAppId" type="xs:string" minOccurs="0"/>
<xs:element name="appId" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
Я ожидаю, по крайней мере, некоторый ответ от службы вместо ничего и тайм-аут.Пожалуйста, помогите мне понять, что я делаю неправильно.