Announcement Announcement Module
Collapse
No announcement yet.
Mtom + axiom + jaxb Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mtom + axiom + jaxb

    I am trying to use the Spring webservice (1.5.9) + JAXB (2.1.5) as data binding. I want to use MTOM for binary data optimization.

    I used the mtom sample provide in spring ws download.

    That sample works great when using SAAJ Message factory. But if i use the axiom message factory I run into one issue -->

    1. storeImage operation works fine. This case the client is sending the mtom message. The axiom + jaxb is able to unmarshal it to java object.
    2. readImage operation whoever, the image in response is sent out the as base 64 encoded text, instead of mtom attachement. Even though on the JAXB marshaller mtom is enabled.

    When i look at AxiomMtomClient.java, i see outputFormat.setDoOptimize(true);, I believe this tell the axiom to do mtom.

    So how I do this in configuration file?

    Right now the only way its seems to do this is programmatic way - extend axiom message factory and get handle to output message format and set this attribute.

    Below is my configuration file attached.

    Any help would be appreciated.. Thanks Shrikant

    ************************************************** ******


    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <bean id="imageRepository" class="org.springframework.ws.samples.mtom.service .StubImageRepository"/>

    <bean class="org.springframework.ws.samples.mtom.ws.Imag eRepositoryEndpoint">
    <constructor-arg ref="imageRepository"/>
    </bean>

    <!-- -->
    <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoap MessageFactory">
    <property name="payloadCaching" value="false" />
    </bean>
    <!-- -->

    <bean class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootAnnotationMethodEndpointMapping"/>

    <bean class="org.springframework.ws.server.endpoint.adap ter.GenericMarshallingMethodEndpointAdapter">
    <constructor-arg ref="marshaller"/>
    </bean>

    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
    <property name="contextPath" value="org.springframework.ws.samples.mtom.schema"/>
    <property name="mtomEnabled" value="true"/>
    </bean>

    <bean id="mtom" class="org.springframework.ws.wsdl.wsdl11.DefaultW sdl11Definition">
    <property name="schema" ref="schema"/>
    <property name="portTypeName" value="ImageRepository"/>
    <property name="locationUri" value="http://localhost:8080/mtom/"/>
    </bean>


    <bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema ">
    <property name="xsd" value="/WEB-INF/schema.xsd"/>
    </bean>

    </beans>
Working...
X