0

我对 SpringWS 有点陌生,我正在尝试让一个简单的应用程序工作。

当我尝试向我的 WS 发送有效的 SOAP 请求时收到以下警告:

WARNING: No endpoint mapping found for [SaajSoapMessage {http://www.sws.com/schemas}LoginRequest]

spring-ws-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:sws="http://www.springframework.org/schema/web-services"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:oxm="http://www.springframework.org/schema/oxm"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd">

    <context:component-scan base-package="com.springws.endpoints"/>

    <bean id="loginService" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
        <property name="wsdl" value="/WEB-INF/wsdl/login.wsdl"/>
    </bean>

    <bean id="loginServiceBean" class="com.springws.service.LoginService"/>

    <sws:annotation-driven marshaller="jaxb2Marshaller" unmarshaller="jaxb2Marshaller"/>

    <oxm:jaxb2-marshaller id="jaxb2Marshaller">
        <oxm:class-to-be-bound name="com.springws.model.LoginResponse"/>
        <oxm:class-to-be-bound name="com.springws.model.LoginRequest"/>
    </oxm:jaxb2-marshaller>

</beans>

静态 WSDL:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:sch="http://www.sws.com/schemas"
             xmlns:tns="http://www.sws.com/wsdl/login.wsdl"
             targetNamespace="http://www.sws.com/wsdl/login.wsdl">

    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:import namespace="http://www.sws.com/schemas" schemaLocation="login.xsd"/>
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="LoginRequest">
        <wsdl:part name="body" element="sch:LoginRequest"/>
    </wsdl:message>
    <wsdl:message name="LoginResponse">
        <wsdl:part name="body" element="sch:LoginResponse"/>
    </wsdl:message>

    <wsdl:portType name="AreValidCredentialsPortType">
        <wsdl:operation name="AreValidCredentials">
            <wsdl:input message="tns:LoginRequest"/>
            <wsdl:output message="tns:LoginResponse"/>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="CredentialValidationSoapBinding" type="tns:AreValidCredentialsPortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="AreValidCredentials">
            <soap:operation soapAction="AreValidCredentials"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="LoginService">
        <wsdl:port name="AreValidCredentialsPort" binding="tns:CredentialValidationSoapBinding">
            <soap:address location="http://localhost:8080/LoginService/"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

XSD:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.sws.com/schemas">

    <xs:element name="LoginRequest">
        <xs:complexType>
            <xs:all>
                <xs:element name="username" type="xs:string"/>
                <xs:element name="password" type="xs:string"/>
                <xs:element name="email" type="xs:string"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="LoginResponse">
        <xs:complexType>
            <xs:all>
                <xs:element name="message" type="xs:string"/>
            </xs:all>
        </xs:complexType>
    </xs:element>
</xs:schema>

和端点:

@Endpoint
public class ValidateLoginEndpoint {

    @Autowired
    LoginServiceInterface loginService;

    @PayloadRoot(localPart = "LoginRequest", namespace = "http://www.sws.com/schemas")
    @ResponsePayload
    public LoginResponse areValidCredentials(@RequestPayload LoginRequest request) {
        System.out.println("been here done this");
        return loginService.validateLoginRequest(request);
    }

关于我做错了什么的任何线索?

4

0 回答 0