Как определить конечную точку на основе схемы в Spring-WS

В Spring WS конечные точки обычно помечаются аннотацией @Endpoint. например

@Endpoint
public class HolidayEndpoint {
    ...
}

Мой вопрос: есть ли способ определить конечную точку на основе схемы (на основе конфигурации XML)? Спасибо...


person hejiaming007    schedule 13.05.2012    source источник


Ответы (2)


В конфигурацию spring-ws-servlet.xml добавьте следующее:

<?xml version="1.0" encoding="UTF-8"?>
<beans>
    <context:annotation-config />
    <sws:annotation-driven />
    <sws:dynamic-wsdl id="holidayEndPoint" portTypeName="HolidayEndpoint"
............
......

Больше информации можно получить отсюда

Не удалось получить доступ к конечной точке веб-службы: Spring-WS 2

Может быть, это поможет вам.

person UVM    schedule 13.05.2012

Создайте и опубликуйте wsdl:

<sws:dynamic-wsdl id="EntityService" portTypeName="Entity" locationUri="/ws/EntityService/"
    targetNamespace="http://me.com/myproject/definitions">
    <sws:xsd location="WEB-INF/schemas/EntityCommons.xsd" />
    <sws:xsd location="WEB-INF/schemas/EntityService.xsd" />
</sws:dynamic-wsdl>

<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
        <props>
            <prop key="ws/EntityService/*.wsdl">EntityService</prop>
        </props>
    </property>
    <property name="defaultHandler" ref="messageDispatcher" />
</bean>

Настройте перехватчик:

<sws:interceptors>
    <bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />

        <!-- Postel's Law: “Be conservative in what you do; be liberal in what you accept from others.” -->
        <bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
        <property name="schema" value="WEB-INF/schemas/EntityService.xsd"/>
        <property name="validateRequest" value="false"/>
        <property name="validateResponse" value="true"/>
    </bean>
</sws:interceptors>

Или, в качестве альтернативы, если вы используете JAXB, вы можете настроить маршаллер для использования схемы.

person molholm    schedule 24.09.2012