java - 如何使用 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;
}
}
解决方案
推荐阅读
- angular - 如何获取 Angular Material 对话框的当前位置
- python-3.x - 如何在 Python 上使用 Mesa 和 Networkx 获取节点之间的距离?
- axios - 如何在axios中获取响应状态码?标准解决方案不起作用
- ruby-on-rails - 当每个案例都有不同的样式时如何从 Rails 视图中删除逻辑
- android - React Native Gradle assembleDebug 需要一个小时
- powershell - 在 PowerShell 中多次重复部分命令
- javascript - 处理从对象数组中抓取对象的更好方法?
- c++ - 如何使用未修饰的导出函数在 C++ 中创建 dll
- c++ - 为什么我的 String 类 append() 方法中有错误?
- c++ - 有没有办法添加用户使用 C++ 输入的行数?