2010-04-13 58 views
1

我有一個XSD文檔,我需要與端點進行通信(僅客戶端) - 是否在春季內置此功能?我一直在使用JAXB,但想知道春天是否有某種包裝。謝謝。Spring中的XSD客戶端

+0

一種究竟是什麼包裝?你使用什麼類型的協議來發送數據?這是REST,SOAP等嗎? – 2010-04-13 18:20:06

+0

簡單的HTTP發佈 – wuntee 2010-04-13 18:40:08

回答

1

最後想通了 - 它改變了WebServiceTemplate上的MessageFactory以使用POX vs SOAP。希望這可以幫助別人!

參考文獻: http://static.springsource.org/spring-ws/sites/1.5/reference/html/client.htmlhttp://static.springsource.org/spring-ws/sites/1.5/reference/html/oxm.html

<?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:aop="http://www.springframework.org/schema/aop" 
     xmlns:util="http://www.springframework.org/schema/util" 
     xmlns:oxm="http://www.springframework.org/schema/oxm" 
     xsi:schemaLocation=" 
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd 
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
      http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd 
      http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd" 
     default-autowire="no" default-init-method="init" default-destroy-method="destroy"> 

    <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> 
     <property name="contextPath" value="com.cable.comcast.neto.nse.sams.pox"/> 
    </bean>  

    <bean id="messageFactory" class="org.springframework.ws.pox.dom.DomPoxMessageFactory"/> 

    <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"> 
     <constructor-arg ref="messageFactory"/>  
     <property name="messageSender"> 
      <bean class="org.springframework.ws.transport.http.CommonsHttpMessageSender" /> 
     </property> 
     <property name="defaultUri" value="http://sams-web.cable.comcast.com/ttsgateway/Inbound"/> 
     <property name="marshaller" ref="jaxb2Marshaller" /> 
     <property name="unmarshaller" ref="jaxb2Marshaller" /> 
    </bean> 
</beans>