0

Two questions about generating JAXB objects.

What is the difference when the Jaxb is configured as shown in the two examples.

Using Maven

<plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaDirectory>src/main/webapp/WEB-INF/schemas</schemaDirectory>
                </configuration>
            </plugin>

Using Spring configuration file

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

Do the above two configuration achieve the same thing?

The second question is how do i enable MTOM using the Maven configuration method?

ziggy
  • 15,677
  • 67
  • 194
  • 287

1 Answers1

1

They are two completely different things.

the maven plugin will auto generate your jaxb entities based on your schema file during the generate-sources maven phase.

the second configurations sets up the jaxb marshaller and tells it that the jaxb entities are located at that contextPath.

so essentially maven is build time and the second configuration is runtime

for you second question. MTOM has nothing to do with maven. they way i got it working was by downloading the spring-ws code and there is a nice sample in there which is very helpful.

Shaun Stone
  • 626
  • 1
  • 5
  • 19