Spring WS 不会为 Endpoint 类中的所有公共方法生成 wsdl 操作



我有一个带有两个公共方法的 Spring 端点类。但是当 Spring 自动生成 wsdl 时,它不包括第二个公共方法。你能不能让我知道出了什么问题,需要做什么。我正在使用 Spring 4.3,下面是类。

配置类

@EnableWs
@Configuration
public class SoapServiceConfig extends WsConfigurerAdapter {
    @Bean
    public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
        MessageDispatcherServlet servlet = new MessageDispatcherServlet();
        servlet.setApplicationContext(applicationContext);
        servlet.setTransformWsdlLocations(true);
        return new ServletRegistrationBean(servlet, "/ws/*");
    }
    @Bean(name = "policies")
    public DefaultWsdl11Definition policyserviceWsdl11Definition(@Autowired @Qualifier("swissSchema") XsdSchema swissSchema) {
        DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
        wsdl11Definition.setPortTypeName("PoliciesPort");
        wsdl11Definition.setLocationUri("/ws");
        wsdl11Definition.setTargetNamespace("http://www.testcomp.com/iaworkflow/soapservice");
        wsdl11Definition.setSchema(swissSchema);
        return wsdl11Definition;
    }
    @Bean(name = "bankservice")
    public DefaultWsdl11Definition bankServiceWsdlDefinition(@Autowired @Qualifier("bankSchema")XsdSchema bankSchema) {
        DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
        wsdl11Definition.setPortTypeName("BankAPIPort");
        wsdl11Definition.setLocationUri("/ws/bankapi");
        wsdl11Definition.setTargetNamespace("http://www.testcomp.com/consumer/bankservice/soapservice");
        wsdl11Definition.setSchema(bankSchema);
        return wsdl11Definition;
    }
    @Bean
    @Qualifier("bankSchema")
    public XsdSchema bankSchema() {
        return new SimpleXsdSchema(new ClassPathResource("bankservice.xsd"));
    }
    @Bean
    @Qualifier("swissSchema")
    public XsdSchema swissSchema() {
        return new SimpleXsdSchema(new ClassPathResource("policylookup.xsd"));
    }
}

端点

@Endpoint
public class BankingServiceEndpoint {
    private static final String NAMESPACE_URI = "http://www.testcomp.com/consumer/bankservice/soapservice";
    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "BankInfoSearchRequest")
    @ResponsePayload
    public BankInfoSearchResponse getBankInfo(@RequestPayload BankInfoSearchRequest request) {
        BankInfoSearchResponse response = createDummyResponse(request.getPolicyNumber(),request.getLimit());
        return response;
    }
    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "BankVerificationRequest")
    @ResponsePayload
    public BankVerificationResponse verifyBankInformation(@RequestPayload BankVerificationRequest request) {

        return BankVerificationResponse.builder().build();
    }
}

生成的 WSDL

<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://www.testcomp.com/consumer/bankservice/soapservice" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.testcomp.com/consumer/bankservice/soapservice" targetNamespace="http://www.testcomp.com/consumer/bankservice/soapservice">
  <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.testcomp.com/consumer/bankservice/soapservice" version="1.0">
    <xs:element name="BankInfoSearchRequest">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="policyNumber" type="xs:string"/>
                <xs:element name="limit" type="xs:int"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="BankInfoSearchResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="1" name="policyNumber" nillable="false" type="xs:string"/>
                <xs:element name="bankdatas" type="tns:BankDatas"/>
                <xs:element maxOccurs="1" name="error" nillable="true" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="BankDatas">
        <xs:sequence>
            <xs:element maxOccurs="unbounded" name="bankinfo" type="tns:BankInfo"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="BankInfo">
        <xs:sequence>
            <xs:element name="AccountNumber" type="xs:string"/>
            <xs:element name="RoutingNumber" type="xs:string"/>
            <xs:element name="BankName" type="xs:string"/>
            <xs:element name="VerificationDescription" type="xs:string"/>
            <xs:element name="VerificationCode" type="xs:string"/>
            <xs:element name="Verified" type="xs:boolean"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="BankVerificationRequest">
        <xs:sequence>
            <xs:element maxOccurs="1" name="PolicyOwnerInformation" type="tns:PolicyOwnerInformation"/>
            <xs:element maxOccurs="1" name="BankInfo" type="tns:BankInfo"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="PolicyOwnerInformation">
        <xs:sequence>
            <xs:element name="FirstName" type="xs:string"/>
            <xs:element name="MiddleName" type="xs:string"/>
            <xs:element name="LastName" type="xs:string"/>
            <xs:element name="SSN" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="BankVerificationResponse">
        <xs:sequence>
            <xs:element maxOccurs="1" name="PolicyOwnerInformation" type="tns:PolicyOwnerInformation"/>
            <xs:element maxOccurs="1" name="Bankinfo" type="tns:BankInfo"/>
            <xs:element name="BankVerificationTransactionId" type="xs:string"/>
            <xs:element name="ItemReferenceId" type="xs:string"/>
            <xs:element name="SubmittedBy" type="xs:string"/>
            <xs:element name="VerificationResponse" type="xs:string"/>
            <xs:element name="VerificationStatus" type="xs:string"/>
            <xs:element name="BankVerificationTransactionType" type="xs:string"/>
            <xs:element name="Created" type="xs:string"/>
            <xs:element name="Success" type="xs:string"/>
            <xs:element name="Error" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="BankInfoSearchResponse">
    <wsdl:part element="tns:BankInfoSearchResponse" name="BankInfoSearchResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="BankInfoSearchRequest">
    <wsdl:part element="tns:BankInfoSearchRequest" name="BankInfoSearchRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="BankAPIPort">
    <wsdl:operation name="BankInfoSearch">
      <wsdl:input message="tns:BankInfoSearchRequest" name="BankInfoSearchRequest">
    </wsdl:input>
      <wsdl:output message="tns:BankInfoSearchResponse" name="BankInfoSearchResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="BankAPIPortSoap11" type="tns:BankAPIPort">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="BankInfoSearch">
      <soap:operation soapAction=""/>
      <wsdl:input name="BankInfoSearchRequest">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="BankInfoSearchResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="BankAPIPortService">
    <wsdl:port binding="tns:BankAPIPortSoap11" name="BankAPIPortSoap11">
      <soap:address location="http://localhost:9080/workflowintg/ws/bankapi"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

我想出了问题。XSD 中存在问题。我将根元素声明为 xs:complexType 而不是 xs:element .

相关内容

  • 没有找到相关文章

最新更新