如何解决如何使用 spring-boot-ws 为 XML 创建 XSD?
我创建 XSD 来为我的服务创建域(方法和参数)。这是我的 XSD
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.baeldung.com/springsoap/gen"
xmlns:imp="http://www.baeldung.com/springsoap/gen"
targetNamespace="http://www.baeldung.com/springsoap/gen" elementFormDefault="qualified">
<xs:element name="reqCountry">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="resCountry">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="population" type="xs:int"/>
<xs:element name="capital" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
但问题是它不会生成方法,但是如果我将名称“reqCountry”替换为“reqCountryRequest”是可以的,但名称应该是 reqCountry。
这是端点类
@Endpoint
public class CountryEndpoint {
@PayloadRoot(namespace = "http://www.baeldung.com/springsoap/gen",localPart = "reqCountry")
@ResponsePayload
public ResCountry getCountry(@RequestPayload ReqCountry request) {
ResCountry response = new ResCountry();
response.setCapital("ESpain");
return response;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。