java—如何使用SpringBootWS为xml创建xsd?

igetnqfo  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(175)

我创建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>

但是问题是它不生成方法,但是如果我用“reqcountryrequest”替换名称“reqcountry”是可以的,但是名称应该是reqcountry。
这是endpoint类

@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;
    }

}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题