views:

31

answers:

1

I have an XSD document 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.

+1  A: 

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"/&gt;
        <property name="marshaller" ref="jaxb2Marshaller" />
        <property name="unmarshaller" ref="jaxb2Marshaller" />
    </bean>
</beans>
wuntee