在WS中,端點通常使用@Endpoint註釋進行註釋。例如如何在Spring中定義基於模式的端點-WS
@Endpoint
public class HolidayEndpoint {
...
}
我的問題是:有沒有什麼辦法來deifine基於模式的端點(基於XML配置)?謝謝...
在WS中,端點通常使用@Endpoint註釋進行註釋。例如如何在Spring中定義基於模式的端點-WS
@Endpoint
public class HolidayEndpoint {
...
}
我的問題是:有沒有什麼辦法來deifine基於模式的端點(基於XML配置)?謝謝...
在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"
............
......
更多信息可以從這裏過
Unable to access web service endpoint: Spring-WS 2
可能,這將幫你。
生成和發佈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>
或者alternativly如果你使用JAXB,您可以配置爲使用該模式的編組。