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