开发者

XSD Client in Spring

开发者 https://www.devze.com 2022-12-26 13:03 出处:网络
I have an XSD d开发者_如何转开发ocument that I need to communicate with an endpoint (client side only) - is there this functionality built into spring? I have been using JAXB, but was wondering if spr

I have an XSD d开发者_如何转开发ocument that I need to communicate with an endpoint (client side only) - is there this functionality built into spring? I have been using JAXB, but was wondering if spring has some sort of wrapper. Thanks.


Finally figured it out - its a matter of changing the MessageFactory on the WebServiceTemplate to use POX vs SOAP. Hope this helps someone!

References: http://static.springsource.org/spring-ws/sites/1.5/reference/html/client.html http://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>
0

精彩评论

暂无评论...
验证码 换一张
取 消