Announcement Announcement Module
Collapse
No announcement yet.
MTOM Example does not compile Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MTOM Example does not compile

    Hi,

    I tried following your instructions and running the ant build command for the JAXWS MTOM client example and finally gave up after a day of retrying and resolving dependencies that Maven failed to download. The worst part is that it does not report all unresolved dependencies at once and you have to run through the build process over and over until you no longer get missing dependencies errors and each build process, on a fast network takes about 8 minutes. I finally resolved all the missing dependencies manually and now the project still does not build and complains about a class that it should find since I manually installed jaxws-api.jar and verified the class is inside the jar.

    Here are the packages I had to manually download and install:

    call mvn install:install-file -DgroupId=com.sun.xml.stream -DartifactId=sjsxp -Dversion=1.0 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/sjsxp.jar
    call mvn install:install-file -DgroupId=com.sun.xml.ws -DartifactId=jaxws-tools -Dversion=EA3 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxws-tools.jar
    call mvn install:install-file -DgroupId=com.sun.xml.stream.buffer -DartifactId=streambuffer -Dversion=0.3 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/streambuffer.jar
    call mvn install:install-file -DgroupId=com.sun.xml.bind -DartifactId=jaxb-xjc -Dversion=2.1-EA2 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxb-xjc.jar
    call mvn install:install-file -DgroupId=org.jvnet.staxex -DartifactId=stax-ex -Dversion=1.0 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/stax-ex.jar
    call mvn install:install-file -DgroupId=javax.activation -DartifactId=activation -Dversion=1.0.2 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/activation.jar
    call mvn install:install-file -DgroupId=javax.xml.ws -DartifactId=jaxws-api -Dversion=2.1-SNAPSHOT -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxws-api.jar
    call mvn install:install-file -DgroupId=org.springframework -DartifactId=spring-core -Dversion=2.0.5 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/spring-core.jar
    call mvn install:install-file -DgroupId=com.sun.xml.ws -DartifactId=jaxws-rt -Dversion=EA3 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxws-rt.jar
    call mvn install:install-file -DgroupId=com.sun.xml.bind -DartifactId=jaxb-impl -Dversion=2.1-EA2 -Dpackaging=jar -Dfile=C:/devtools/tools/java-tools/exe/spring-ws/jars/jaxb-impl.jar


    And here is the final error:


    C:\devtools\tools\java-tools\exe\spring-ws\spring-ws-1.5.6\samples\mtom\client\jaxws>ant build
    Buildfile: build.xml

    init:
    [artifact:dependencies] Downloading: com/sun/xml/ws/jaxws-tools/EA3/jaxws-tools-EA3.pom
    [artifact:dependencies] Downloading: com.sun.xml.ws/poms/jaxws-tools-EA3.pom
    [artifact:dependencies] Downloading: com/sun/xml/bind/jaxb-xjc/2.1-EA2/jaxb-xjc-2.1-EA2.pom
    [artifact:dependencies] Downloading: com.sun.xml.bind/poms/jaxb-xjc-2.1-EA2.pom
    [artifact:dependencies] Downloading: com/sun/xml/stream/buffer/streambuffer/0.3/streambuffer-0.3.pom
    [artifact:dependencies] Downloading: com.sun.xml.stream.buffer/poms/streambuffer-0.3.pom
    [artifact:dependencies] Downloading: com/sun/xml/stream/sjsxp/1.0/sjsxp-1.0.pom
    [artifact:dependencies] Downloading: com.sun.xml.stream/poms/sjsxp-1.0.pom
    [artifact:dependencies] Downloading: org/jvnet/staxex/stax-ex/1.0/stax-ex-1.0.pom
    [artifact:dependencies] Downloading: org.jvnet.staxex/poms/stax-ex-1.0.pom
    [artifact:dependencies] Downloading: javax/activation/activation/1.0.2/activation-1.0.2.pom
    [artifact:dependencies] Downloading: javax.activation/poms/activation-1.0.2.pom
    [artifact:dependencies] Downloading: javax/xml/ws/jaxws-api/2.1-SNAPSHOT/jaxws-api-2.1-SNAPSHOT.pom
    [artifact:dependencies] Downloading: javax.xml.ws/poms/jaxws-api-2.1-SNAPSHOT.pom
    [artifact:dependencies] Downloading: org/springframework/spring-core/2.0.5/spring-core-2.0.5.pom
    [artifact:dependencies] Downloading: org.springframework/poms/spring-core-2.0.5.pom
    [artifact:dependencies] Downloading: com/sun/xml/ws/jaxws-rt/EA3/jaxws-rt-EA3.pom
    [artifact:dependencies] Downloading: com.sun.xml.ws/poms/jaxws-rt-EA3.pom
    [artifact:dependencies] Downloading: com/sun/xml/bind/jaxb-impl/2.1-EA2/jaxb-impl-2.1-EA2.pom
    [artifact:dependencies] Downloading: com.sun.xml.bind/poms/jaxb-impl-2.1-EA2.pom

    generate:

    BUILD FAILED
    C:\devtools\tools\java-tools\exe\spring-ws\spring-ws-1.5.6\samples\mtom\client\jaxws\build.xml:56: java.lang.NoClassDefFoundError: javax/xml/ws/Service

    Total time: 7 minutes 1 second

  • #2
    Here is How to do it with MTOM

    First, I would like to mention that most of the problems I had were due to the fact that I was too green to Spring-WS and Maven. I finally figured out how to use the MTOM example and create my own. Here is how I did it:

    1 - POM.xml (I used the JAXB2 implementation from EclipseLink but you can comment that section out and use Sun's implementation if you like):

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.oracle.mtom</groupId>
    <artifactId>mtomService2</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>mtomService2 Spring-WS Application</name>
    <url>http://www.springframework.org/spring-ws</url>
    <build>
    <finalName>mtomService2</finalName>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
    <source>1.5</source>
    <target>1.5</target>
    </configuration>
    </plugin>
    <plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <executions>
    <execution>
    <goals>
    <goal>generate</goal>
    </goals>
    </execution>
    </executions>
    <configuration>
    <generatePackage>com.oracle.mtom.schema</generatePackage>
    <schemaDirectory>src/main/webapp/WEB-INF</schemaDirectory>
    </configuration>
    </plugin>
    <plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <executions>
    <execution>
    <id>copy-resources</id>
    <!-- here the phase you need -->
    <phase>validate</phase>
    <goals>
    <goal>copy-resources</goal>
    </goals>
    <configuration>
    <outputDirectory>${basedir}/target/mtomService2/cache</outputDirectory>
    <resources>
    <resource>
    <directory>src/main/webapp/cache</directory>
    <filtering>true</filtering>
    </resource>
    </resources>
    </configuration>
    </execution>
    </executions>
    </plugin>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    </plugin>
    </plugins>
    </build>
    <repositories>
    <repository>
    <id>maven2-repository.dev.java.net</id>
    <name>Java.net Maven 2 Repository</name>
    <url>http://download.java.net/maven/2</url>
    </repository>
    <repository>
    <id>maven-repository.dev.java.net</id>
    <name>Java.net Maven 1 Repository (legacy)</name>
    <url>http://download.java.net/maven/1</url>
    <layout>legacy</layout>
    </repository>
    </repositories>
    <pluginRepositories>
    <pluginRepository>
    <id>maven2-repository.dev.java.net</id>
    <name>Java.net Maven 2 Repository</name>
    <url>http://download.java.net/maven/2</url>
    </pluginRepository>
    <pluginRepository>
    <id>maven-repository.dev.java.net</id>
    <name>Java.net Maven 1 Repository (legacy)</name>
    <url>http://download.java.net/maven/1</url>
    <layout>legacy</layout>
    </pluginRepository>
    </pluginRepositories>
    <dependencies>
    <dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-ws-core-tiger</artifactId>
    <version>1.5.6</version>
    <exclusions>
    <exclusion>
    <groupId>wsdl4j</groupId>
    <artifactId>wsdl4j</artifactId>
    </exclusion>
    </exclusions>
    </dependency>
    <dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-oxm-tiger</artifactId>
    <version>1.5.6</version>
    <scope>runtime</scope>
    </dependency>

    <dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>1.4</version>
    </dependency>

    <dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1</version>
    </dependency>

    <!--
    <dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.1</version>
    <exclusions>
    <exclusion>
    <groupId>javax.xml.stream</groupId>
    <artifactId>stax-api</artifactId>
    </exclusion>
    </exclusions>
    </dependency>

    <dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.1.5</version>
    </dependency>
    -->
    <!-- EclipseLink JAXB2 interface -->
    <dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>javax.xml.bind</artifactId>
    <version>2.0.0.v20080604-1500</version>
    </dependency>

    <!-- EclipseLink JAXB2 implementation -->
    <dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>eclipselink</artifactId>
    <version>2.0</version>
    </dependency>

    <!--
    <dependency>
    <groupId>com.oracle.jaxb</groupId>
    <artifactId>oracle-jaxb-package</artifactId>
    <version>1.0-SNAPSHOT</version>
    </dependency>
    -->

    <!-- SAAJ -->

    <!-- Sun's public API -->

    <dependency>
    <groupId>javax.xml.soap</groupId>
    <artifactId>saaj-api</artifactId>
    <version>1.3</version>
    </dependency>


    <!--Sun's SAAJ implementation. -->

    <dependency>
    <groupId>com.sun.xml.messaging.saaj</groupId>
    <artifactId>saaj-impl</artifactId>
    <version>1.3</version>
    </dependency>

    <!-- Oracle's SAAJ implementation -->
    <!--
    <dependency>
    <groupId>oracle.j2ee.ws.saaj</groupId>
    <artifactId>orasaaj</artifactId>
    <version>11.1.1.0.0</version>
    </dependency>

    <dependency>
    <groupId>javax.xml</groupId>
    <artifactId>xmlparserv2</artifactId>
    <version>11.1.0.6.0_production</version>
    </dependency>
    -->

    <!-- STAX -->
    <dependency>
    <groupId>javax.xml.stream</groupId>
    <artifactId>stax-api</artifactId>
    <version>1.0-2</version>
    </dependency>

    <dependency>
    <groupId>javanet.staxutils</groupId>
    <artifactId>stax-utils</artifactId>
    <version>1.0.1</version>
    </dependency>

    continues on next thread....
    Last edited by joe_roberts_z; May 18th, 2009, 04:33 PM.

    Comment


    • #3
      Here is How to do it with MTOM (part 2)

      <!-- Woodstox STAX -->

      <dependency>
      <groupId>woodstox-core-asl</groupId>
      <artifactId>woodstox-core-asl</artifactId>
      <version>4.0.3</version>
      </dependency>

      <dependency>
      <groupId>stax2-api</groupId>
      <artifactId>stax2-api</artifactId>
      <version>3.0.1</version>
      </dependency>

      <!-- Oracle dependencies for WSDL4J -->
      <dependency>
      <groupId>oracle</groupId>
      <artifactId>orawsdl</artifactId>
      <version>11.1.1</version>
      </dependency>

      <dependency>
      <groupId>oracle</groupId>
      <artifactId>oracle_http_client_</artifactId>
      <version>11.1.1</version>
      </dependency>

      <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.4</version>
      <scope>system</scope>
      <systemPath>c:/java/tomcat/common/lib/servlet-api.jar</systemPath>
      </dependency>

      <!-- JMS Jars Dependencies -->
      <dependency>
      <groupId>org.springframework.jms</groupId>
      <artifactId>spring-jms</artifactId>
      <version>2.0.6</version>
      </dependency>

      <dependency>
      <groupId>org.springframework.dao</groupId>
      <artifactId>spring-dao</artifactId>
      <version>2.0.6</version>
      </dependency>

      <dependency>
      <groupId>javax.jms</groupId>
      <artifactId>jms</artifactId>
      <version>1.1</version>
      </dependency>

      <dependency>
      <groupId>com.oracle.transport</groupId>
      <artifactId>oracle-jms-package</artifactId>
      <version>1.0-SNAPSHOT</version>
      </dependency>

      <!-- IBM Jars for JMS -->
      <dependency>
      <groupId>com.ibm.mq</groupId>
      <artifactId>com.ibm.mq</artifactId>
      <version>6.0</version>
      </dependency>

      <dependency>
      <groupId>javax.resource.cci</groupId>
      <artifactId>connector</artifactId>
      <version>6.0</version>
      </dependency>

      <dependency>
      <groupId>com.ibm.mq.jms</groupId>
      <artifactId>com.ibm.mqjms</artifactId>
      <version>6.0</version>
      </dependency>

      <dependency>
      <groupId>com.ibm.disthub2</groupId>
      <artifactId>dhbcore</artifactId>
      <version>6.0</version>
      </dependency>

      <dependency>
      <groupId>javax.transaction.xa</groupId>
      <artifactId>jta</artifactId>
      <version>6.0</version>
      </dependency>

      <!-- ActiveMQ Jars for JMS -->
      <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>apache-activemq-all</artifactId>
      <version>5.1.0</version>
      </dependency>

      <!-- Dependencies for mail sender Follow -->
      <dependency>
      <groupId>org.springframework.ws.transport</groupId>
      <artifactId>spring-ws-support</artifactId>
      <version>1.5.6</version>
      </dependency>

      <dependency>
      <groupId>org.apache.commons.httpclient</groupId>
      <artifactId>commons-httpclient</artifactId>
      <version>3.1</version>
      </dependency>

      <dependency>
      <groupId>org.apache.commons.codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.3</version>
      </dependency>

      <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.15</version>
      <exclusions>
      <exclusion>
      <groupId>com.sun.jdmk</groupId>
      <artifactId>jmxtools</artifactId>
      </exclusion>
      <exclusion>
      <groupId>com.sun.jmx</groupId>
      <artifactId>jmxri</artifactId>
      </exclusion>
      </exclusions>
      </dependency>

      </dependencies>
      </project>

      continues on next thread....

      Comment


      • #4
        Here is How to do it with MTOM (part 3)

        2 - Schema for the web service (will be the same for the client side):

        <?xml version="1.0" encoding="UTF-8"?>
        <schema xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://oracle.com/mtom"
        xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
        targetNamespace="http://oracle.com/mtom"
        elementFormDefault="qualified">
        <complexType name="Attachment">
        <sequence>
        <element name="name" type="string"/>
        <element name="content" type="base64Binary" xmime:expectedContentTypes="*/*"/>
        </sequence>
        </complexType>
        <complexType name="Package">
        <sequence>
        <element name="PackageTitle" type="xsd:string"/>
        <element name="Recipient1" type="xsd:string"/>
        <element name="Recipient2" type="xsd:string"/>
        <element name="Recipient3" type="xsd:string"/>
        <element name="StartDate" type="xsd:date" minOccurs="0" maxOccurs="1"/>
        <element name="EndDate" type="xsd:date" minOccurs="0" maxOccurs="1"/>
        <element name="Attachment" type="tns:Attachment" minOccurs="0" maxOccurs="unbounded"/>
        <element name="Optional1" type="xsd:string" minOccurs="0" maxOccurs="1"/>
        </sequence>
        </complexType>
        <element name="TestRequest" type="tns:Package"/>
        <complexType name="PackageResponse">
        <sequence>
        <element name="Results" type="string"/>
        <element name="ArchiveDate" type="xsd:date" minOccurs="0" maxOccurs="1"/>
        </sequence>
        </complexType>
        <element name="TestResponse" type="tns:PackageResponse"/>
        </schema>

        continues on next thread....

        Comment


        • #5
          Here is how to do it with MTOM (part 4)

          3 - Spring Web service config. file:

          <?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="testRepository" class="com.oracle.mtom.service.StubTestRepository"/>

          <bean class="com.oracle.mtom.ws.TestRepositoryEndpoint">
          <constructor-arg ref="testRepository"/>
          </bean>

          <!-- Uses annotations -->
          <bean class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootAnnotationMethodEndpointMapping">
          <property name="interceptors">
          <list>
          <!-- Logs messages -->
          <ref bean="loggingInterceptor"/>
          <ref bean="validatingInterceptor"/>
          </list>
          </property>
          </bean>

          <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">
          <!--A list of colon : separated package names that contain schema derived classes -->
          <property name="contextPath" value="com.oracle.mtom.schema"/>
          <!--Enables / disables MTOM -->
          <property name="mtomEnabled" value="true"/>
          <!--Used for validation. Cannot validate when MTOM is enabled. -->
          <!-- <property name="schema" value="/WEB-INF/schema.xsd"/> -->
          </bean>

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

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

          <!-- Logs the messages to stdout -->
          <bean id="loggingInterceptor" class="org.springframework.ws.soap.server.endpoint .interceptor.SoapEnvelopeLoggingInterceptor">
          <property name="logRequest" value="true"/>
          <property name="logResponse" value="true"/>
          </bean>

          <bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint .interceptor.PayloadValidatingInterceptor">
          <property name="schema" value="/WEB-INF/schema.xsd"/>
          <property name="validateRequest" value="true"/>
          <property name="validateResponse" value="true"/>
          <property name="errorHandler" value="com.oracle.validation.handler.ValidationErr orHandler"/>
          <property name="skipElements" value="content"/>
          </bean>


          </beans>

          continues on next thread....

          Comment


          • #6
            Here is How to do it with MTOM (part 5)

            4 - Classes Generated by the Maven and JAXB2

            //
            // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-792
            // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
            // Any modifications to this file will be lost upon recompilation of the source schema.
            // Generated on: 2009.05.18 at 04:56:56 PM EDT
            //


            package com.oracle.mtom.schema;

            import javax.activation.DataHandler;
            import javax.xml.bind.annotation.XmlAccessType;
            import javax.xml.bind.annotation.XmlAccessorType;
            import javax.xml.bind.annotation.XmlElement;
            import javax.xml.bind.annotation.XmlMimeType;
            import javax.xml.bind.annotation.XmlType;


            /**
            * <p>Java class for Attachment complex type.
            *
            * <p>The following schema fragment specifies the expected content contained within this class.
            *
            * <pre>
            * &lt;complexType name="Attachment">
            * &lt;complexContent>
            * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
            * &lt;sequence>
            * &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
            * &lt;element name="content" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
            * &lt;/sequence>
            * &lt;/restriction>
            * &lt;/complexContent>
            * &lt;/complexType>
            * </pre>
            *
            *
            */
            @XmlAccessorType(XmlAccessType.FIELD)
            @XmlType(name = "Attachment", propOrder = {
            "name",
            "content"
            })
            public class Attachment {

            @XmlElement(required = true)
            protected String name;
            @XmlElement(required = true)
            @XmlMimeType("*/*")
            protected DataHandler content;

            /**
            * Gets the value of the name property.
            *
            * @return
            * possible object is
            * {@link String }
            *
            */
            public String getName() {
            return name;
            }

            /**
            * Sets the value of the name property.
            *
            * @param value
            * allowed object is
            * {@link String }
            *
            */
            public void setName(String value) {
            this.name = value;
            }

            /**
            * Gets the value of the content property.
            *
            * @return
            * possible object is
            * {@link DataHandler }
            *
            */
            public DataHandler getContent() {
            return content;
            }

            /**
            * Sets the value of the content property.
            *
            * @param value
            * allowed object is
            * {@link DataHandler }
            *
            */
            public void setContent(DataHandler value) {
            this.content = value;
            }

            }

            continues on next thread....

            Comment


            • #7
              Here is How to do it with MTOM (part 6)

              Section 4 continues....

              //
              // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-792
              // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
              // Any modifications to this file will be lost upon recompilation of the source schema.
              // Generated on: 2009.05.18 at 04:56:56 PM EDT
              //


              package com.oracle.mtom.schema;

              import javax.xml.bind.JAXBElement;
              import javax.xml.bind.annotation.XmlElementDecl;
              import javax.xml.bind.annotation.XmlRegistry;
              import javax.xml.namespace.QName;


              /**
              * This object contains factory methods for each
              * Java content interface and Java element interface
              * generated in the com.oracle.mtom.schema package.
              * <p>An ObjectFactory allows you to programatically
              * construct new instances of the Java representation
              * for XML content. The Java representation of XML
              * content can consist of schema derived interfaces
              * and classes representing the binding of schema
              * type definitions, element declarations and model
              * groups. Factory methods for each of these are
              * provided in this class.
              *
              */
              @XmlRegistry
              public class ObjectFactory {

              private final static QName _TestResponse_QNAME = new QName("http://oracle.com/mtom", "TestResponse");
              private final static QName _TestRequest_QNAME = new QName("http://oracle.com/mtom", "TestRequest");

              /**
              * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.oracle.mtom.schema
              *
              */
              public ObjectFactory() {
              }

              /**
              * Create an instance of {@link PackageResponse }
              *
              */
              public PackageResponse createPackageResponse() {
              return new PackageResponse();
              }

              /**
              * Create an instance of {@link Attachment }
              *
              */
              public Attachment createAttachment() {
              return new Attachment();
              }

              /**
              * Create an instance of {@link Package }
              *
              */
              public Package createPackage() {
              return new Package();
              }

              /**
              * Create an instance of {@link JAXBElement }{@code <}{@link PackageResponse }{@code >}}
              *
              */
              @XmlElementDecl(namespace = "http://oracle.com/mtom", name = "TestResponse")
              public JAXBElement<PackageResponse> createTestResponse(PackageResponse value) {
              return new JAXBElement<PackageResponse>(_TestResponse_QNAME, PackageResponse.class, null, value);
              }

              /**
              * Create an instance of {@link JAXBElement }{@code <}{@link Package }{@code >}}
              *
              */
              @XmlElementDecl(namespace = "http://oracle.com/mtom", name = "TestRequest")
              public JAXBElement<Package> createTestRequest(Package value) {
              return new JAXBElement<Package>(_TestRequest_QNAME, Package.class, null, value);
              }

              }

              continues on next thread...
              Last edited by joe_roberts_z; May 18th, 2009, 04:41 PM.

              Comment


              • #8
                Here is How to do it with MTOM (part 7)

                Section 4 continues ....

                //
                // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-792
                // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
                // Any modifications to this file will be lost upon recompilation of the source schema.
                // Generated on: 2009.05.18 at 04:56:56 PM EDT
                //


                package com.oracle.mtom.schema;

                import java.util.ArrayList;
                import java.util.List;
                import javax.xml.bind.annotation.XmlAccessType;
                import javax.xml.bind.annotation.XmlAccessorType;
                import javax.xml.bind.annotation.XmlElement;
                import javax.xml.bind.annotation.XmlSchemaType;
                import javax.xml.bind.annotation.XmlType;
                import javax.xml.datatype.XMLGregorianCalendar;


                /**
                * <p>Java class for Package complex type.
                *
                * <p>The following schema fragment specifies the expected content contained within this class.
                *
                * <pre>
                * &lt;complexType name="Package">
                * &lt;complexContent>
                * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
                * &lt;sequence>
                * &lt;element name="PackageTitle" type="{http://www.w3.org/2001/XMLSchema}string"/>
                * &lt;element name="Recipient1" type="{http://www.w3.org/2001/XMLSchema}string"/>
                * &lt;element name="Recipient2" type="{http://www.w3.org/2001/XMLSchema}string"/>
                * &lt;element name="Recipient3" type="{http://www.w3.org/2001/XMLSchema}string"/>
                * &lt;element name="StartDate" type="{http://www.w3.org/2001/XMLSchema}date" minOccurs="0"/>
                * &lt;element name="EndDate" type="{http://www.w3.org/2001/XMLSchema}date" minOccurs="0"/>
                * &lt;element name="Attachment" type="{http://oracle.com/mtom}Attachment" maxOccurs="unbounded" minOccurs="0"/>
                * &lt;element name="Optional1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
                * &lt;/sequence>
                * &lt;/restriction>
                * &lt;/complexContent>
                * &lt;/complexType>
                * </pre>
                *
                *
                */
                @XmlAccessorType(XmlAccessType.FIELD)
                @XmlType(name = "Package", propOrder = {
                "packageTitle",
                "recipient1",
                "recipient2",
                "recipient3",
                "startDate",
                "endDate",
                "attachment",
                "optional1"
                })
                public class Package {

                @XmlElement(name = "PackageTitle", required = true)
                protected String packageTitle;
                @XmlElement(name = "Recipient1", required = true)
                protected String recipient1;
                @XmlElement(name = "Recipient2", required = true)
                protected String recipient2;
                @XmlElement(name = "Recipient3", required = true)
                protected String recipient3;
                @XmlElement(name = "StartDate")
                @XmlSchemaType(name = "date")
                protected XMLGregorianCalendar startDate;
                @XmlElement(name = "EndDate")
                @XmlSchemaType(name = "date")
                protected XMLGregorianCalendar endDate;
                @XmlElement(name = "Attachment")
                protected List<Attachment> attachment;
                @XmlElement(name = "Optional1")
                protected String optional1;

                /**
                * Gets the value of the packageTitle property.
                *
                * @return
                * possible object is
                * {@link String }
                *
                */
                public String getPackageTitle() {
                return packageTitle;
                }

                /**
                * Sets the value of the packageTitle property.
                *
                * @param value
                * allowed object is
                * {@link String }
                *
                */
                public void setPackageTitle(String value) {
                this.packageTitle = value;
                }

                /**
                * Gets the value of the recipient1 property.
                *
                * @return
                * possible object is
                * {@link String }
                *
                */
                public String getRecipient1() {
                return recipient1;
                }

                /**
                * Sets the value of the recipient1 property.
                *
                * @param value
                * allowed object is
                * {@link String }
                *
                */
                public void setRecipient1(String value) {
                this.recipient1 = value;
                }

                /**
                * Gets the value of the recipient2 property.
                *
                * @return
                * possible object is
                * {@link String }
                *
                */
                public String getRecipient2() {
                return recipient2;
                }

                /**
                * Sets the value of the recipient2 property.
                *
                * @param value
                * allowed object is
                * {@link String }
                *
                */
                public void setRecipient2(String value) {
                this.recipient2 = value;
                }

                /**
                * Gets the value of the recipient3 property.
                *
                * @return
                * possible object is
                * {@link String }
                *
                */
                public String getRecipient3() {
                return recipient3;
                }

                /**
                * Sets the value of the recipient3 property.
                *
                * @param value
                * allowed object is
                * {@link String }
                *
                */
                public void setRecipient3(String value) {
                this.recipient3 = value;
                }

                /**
                * Gets the value of the startDate property.
                *
                * @return
                * possible object is
                * {@link XMLGregorianCalendar }
                *
                */
                public XMLGregorianCalendar getStartDate() {
                return startDate;
                }

                /**
                * Sets the value of the startDate property.
                *
                * @param value
                * allowed object is
                * {@link XMLGregorianCalendar }
                *
                */
                public void setStartDate(XMLGregorianCalendar value) {
                this.startDate = value;
                }

                /**
                * Gets the value of the endDate property.
                *
                * @return
                * possible object is
                * {@link XMLGregorianCalendar }
                *
                */
                public XMLGregorianCalendar getEndDate() {
                return endDate;
                }

                /**
                * Sets the value of the endDate property.
                *
                * @param value
                * allowed object is
                * {@link XMLGregorianCalendar }
                *
                */
                public void setEndDate(XMLGregorianCalendar value) {
                this.endDate = value;
                }

                /**
                * Gets the value of the attachment property.
                *
                * <p>
                * This accessor method returns a reference to the live list,
                * not a snapshot. Therefore any modification you make to the
                * returned list will be present inside the JAXB object.
                * This is why there is not a <CODE>set</CODE> method for the attachment property.
                *
                * <p>
                * For example, to add a new item, do as follows:
                * <pre>
                * getAttachment().add(newItem);
                * </pre>
                *
                *
                * <p>
                * Objects of the following type(s) are allowed in the list
                * {@link Attachment }
                *
                *
                */
                public List<Attachment> getAttachment() {
                if (attachment == null) {
                attachment = new ArrayList<Attachment>();
                }
                return this.attachment;
                }

                /**
                * Gets the value of the optional1 property.
                *
                * @return
                * possible object is
                * {@link String }
                *
                */
                public String getOptional1() {
                return optional1;
                }

                /**
                * Sets the value of the optional1 property.
                *
                * @param value
                * allowed object is
                * {@link String }
                *
                */
                public void setOptional1(String value) {
                this.optional1 = value;
                }

                }

                continues on next thread...

                Comment


                • #9
                  Here is how to do it with MTOM (part 8)

                  Section 4 continues...

                  Package-info.java content:

                  //
                  // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-792
                  // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
                  // Any modifications to this file will be lost upon recompilation of the source schema.
                  // Generated on: 2009.05.18 at 04:56:56 PM EDT
                  //

                  @javax.xml.bind.annotation.XmlSchema(namespace = "http://oracle.com/mtom", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
                  package com.oracle.mtom.schema;


                  PackageResponse.java content:

                  //
                  // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-792
                  // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
                  // Any modifications to this file will be lost upon recompilation of the source schema.
                  // Generated on: 2009.05.18 at 04:56:56 PM EDT
                  //


                  package com.oracle.mtom.schema;

                  import javax.xml.bind.annotation.XmlAccessType;
                  import javax.xml.bind.annotation.XmlAccessorType;
                  import javax.xml.bind.annotation.XmlElement;
                  import javax.xml.bind.annotation.XmlSchemaType;
                  import javax.xml.bind.annotation.XmlType;
                  import javax.xml.datatype.XMLGregorianCalendar;


                  /**
                  * <p>Java class for PackageResponse complex type.
                  *
                  * <p>The following schema fragment specifies the expected content contained within this class.
                  *
                  * <pre>
                  * &lt;complexType name="PackageResponse">
                  * &lt;complexContent>
                  * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
                  * &lt;sequence>
                  * &lt;element name="Results" type="{http://www.w3.org/2001/XMLSchema}string"/>
                  * &lt;element name="ArchiveDate" type="{http://www.w3.org/2001/XMLSchema}date" minOccurs="0"/>
                  * &lt;/sequence>
                  * &lt;/restriction>
                  * &lt;/complexContent>
                  * &lt;/complexType>
                  * </pre>
                  *
                  *
                  */
                  @XmlAccessorType(XmlAccessType.FIELD)
                  @XmlType(name = "PackageResponse", propOrder = {
                  "results",
                  "archiveDate"
                  })
                  public class PackageResponse {

                  @XmlElement(name = "Results", required = true)
                  protected String results;
                  @XmlElement(name = "ArchiveDate")
                  @XmlSchemaType(name = "date")
                  protected XMLGregorianCalendar archiveDate;

                  /**
                  * Gets the value of the results property.
                  *
                  * @return
                  * possible object is
                  * {@link String }
                  *
                  */
                  public String getResults() {
                  return results;
                  }

                  /**
                  * Sets the value of the results property.
                  *
                  * @param value
                  * allowed object is
                  * {@link String }
                  *
                  */
                  public void setResults(String value) {
                  this.results = value;
                  }

                  /**
                  * Gets the value of the archiveDate property.
                  *
                  * @return
                  * possible object is
                  * {@link XMLGregorianCalendar }
                  *
                  */
                  public XMLGregorianCalendar getArchiveDate() {
                  return archiveDate;
                  }

                  /**
                  * Sets the value of the archiveDate property.
                  *
                  * @param value
                  * allowed object is
                  * {@link XMLGregorianCalendar }
                  *
                  */
                  public void setArchiveDate(XMLGregorianCalendar value) {
                  this.archiveDate = value;
                  }

                  }

                  continues on next thread....

                  Comment


                  • #10
                    Here is how to do it with MTOM (part 9)

                    5 - The endpoint classes:

                    package com.oracle.mtom.ws;

                    import java.io.ByteArrayOutputStream;
                    import java.io.IOException;
                    import java.util.Calendar;
                    import java.util.TimeZone;
                    import java.util.GregorianCalendar;
                    import javax.xml.datatype.DatatypeFactory;
                    import javax.xml.datatype.DatatypeConfigurationException;
                    import javax.activation.DataHandler;
                    import javax.xml.bind.JAXBElement;

                    import org.springframework.util.Assert;
                    import com.oracle.mtom.schema.*;
                    import com.oracle.mtom.service.*;
                    import org.springframework.ws.server.endpoint.annotation. Endpoint;
                    import org.springframework.ws.server.endpoint.annotation. PayloadRoot;

                    import javax.xml.namespace.QName;

                    @Endpoint
                    public class TestRepositoryEndpoint {

                    private TestRepository testRepository;

                    private ObjectFactory objectFactory;

                    public TestRepositoryEndpoint(TestRepository testRepository) {
                    Assert.notNull(testRepository, "'testRepository' must not be null");
                    this.testRepository = testRepository;
                    this.objectFactory = new ObjectFactory();
                    }

                    @PayloadRoot(localPart = "TestRequest", namespace = "http://oracle.com/mtom")
                    public JAXBElement<PackageResponse> store(JAXBElement<com.oracle.mtom.schema.Package> requestElement) throws IOException {

                    com.oracle.mtom.schema.Package request = requestElement.getValue();

                    int result = testRepository.storePackage(request);

                    com.oracle.mtom.schema.PackageResponse rsp = new com.oracle.mtom.schema.PackageResponse();

                    rsp.setResults("" + result);

                    DatatypeFactory factory = null;
                    try{
                    factory = DatatypeFactory.newInstance();
                    }catch(DatatypeConfigurationException e){
                    throw new IOException(e.getMessage());
                    }
                    TimeZone tz = TimeZone.getTimeZone("UTC");
                    GregorianCalendar gc = new GregorianCalendar(tz);
                    rsp.setArchiveDate(factory.newXMLGregorianCalendar (gc));

                    return objectFactory.createTestResponse(rsp);

                    }

                    }


                    /*
                    * Copyright 2007 the original author or authors.
                    *
                    * Licensed under the Apache License, Version 2.0 (the "License");
                    * you may not use this file except in compliance with the License.
                    * You may obtain a copy of the License at
                    *
                    * http://www.apache.org/licenses/LICENSE-2.0
                    *
                    * Unless required by applicable law or agreed to in writing, software
                    * distributed under the License is distributed on an "AS IS" BASIS,
                    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
                    * See the License for the specific language governing permissions and
                    * limitations under the License.
                    */

                    package com.oracle.mtom.service;

                    import java.util.List;
                    import java.io.IOException;
                    import java.io.FileOutputStream;
                    import javax.activation.DataHandler;
                    import org.apache.commons.logging.Log;
                    import org.apache.commons.logging.LogFactory;

                    import org.springframework.web.context.ServletContextAwar e;
                    import javax.servlet.ServletContext;

                    import com.oracle.mtom.schema.*;


                    public class StubTestRepository implements TestRepository, ServletContextAware {

                    private static final Log logger = LogFactory.getLog(StubTestRepository.class);

                    private ServletContext context;


                    public int storePackage(com.oracle.mtom.schema.Package request) throws IOException {
                    int result = 0;
                    if (request != null){

                    System.out.println("*****Processing Package*****");
                    System.out.println("Storing package <" + request.getPackageTitle() + ">");
                    System.out.println("Recipient1=<" + request.getRecipient1() + ">");
                    System.out.println("Recipient2=<" + request.getRecipient2() + ">");
                    System.out.println("Recipient3=<" + request.getRecipient3() + ">");
                    System.out.println("Start Date=<" + request.getStartDate() + ">");
                    System.out.println("End Date=<" + request.getEndDate() + ">");

                    if (context != null){

                    try{
                    List attachment = request.getAttachment();

                    for(int i=0; attachment != null && i < attachment.size(); i++){
                    Attachment atc = (Attachment)attachment.get(i);
                    String fileName = context.getRealPath("cache") + "/" + atc.getName();
                    System.out.println("Storing attachment <" + atc.getName() + "> to <" + fileName + ">");
                    DataHandler dh = atc.getContent();
                    FileOutputStream fos = new FileOutputStream(fileName);
                    dh.writeTo(fos);
                    fos.close();
                    }
                    }catch(IOException e){
                    e.printStackTrace();
                    throw e;
                    }
                    }

                    result = 1;
                    }
                    return result;
                    }

                    public void setServletContext(ServletContext context){
                    this.context = context;
                    }
                    }


                    /*
                    * Copyright 2007 the original author or authors.
                    *
                    * Licensed under the Apache License, Version 2.0 (the "License");
                    * you may not use this file except in compliance with the License.
                    * You may obtain a copy of the License at
                    *
                    * http://www.apache.org/licenses/LICENSE-2.0
                    *
                    * Unless required by applicable law or agreed to in writing, software
                    * distributed under the License is distributed on an "AS IS" BASIS,
                    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
                    * See the License for the specific language governing permissions and
                    * limitations under the License.
                    */

                    package com.oracle.mtom.service;

                    import java.io.IOException;

                    import com.oracle.mtom.schema.*;

                    /** @author Arjen Poutsma */
                    public interface TestRepository {

                    int storePackage(com.oracle.mtom.schema.Package request) throws IOException;

                    }

                    continues on the next thread...

                    Comment


                    • #11
                      Here is How to do it with MTOM (part 10)

                      6 - Here is the code for the client (It uses the same schema as the server side, already included in one of the previous parts):

                      package com.oracle.mtom.client;

                      import java.io.IOException;
                      import java.io.File;
                      import java.util.Calendar;
                      import java.util.TimeZone;
                      import java.util.GregorianCalendar;
                      import javax.xml.datatype.DatatypeFactory;
                      import javax.xml.datatype.DatatypeConstants;
                      import javax.activation.FileDataSource;
                      import javax.activation.DataHandler;
                      import javax.xml.transform.TransformerException;
                      import javax.xml.transform.stream.StreamResult;

                      import org.springframework.context.ApplicationContext;
                      import org.springframework.context.support.ClassPathXmlAp plicationContext;
                      import org.springframework.ws.client.core.support.WebServ iceGatewaySupport;
                      import org.springframework.xml.transform.StringSource;
                      import org.springframework.ws.WebServiceMessage;
                      import org.springframework.ws.client.core.WebServiceMessa geCallback;
                      import org.springframework.ws.soap.SoapMessage;
                      import org.springframework.ws.soap.addressing.core.Endpoi ntReference;
                      import org.springframework.ws.soap.addressing.client.Acti onCallback;
                      import java.net.URI;
                      import org.springframework.ws.soap.addressing.version.Add ressing10;

                      import javax.xml.bind.JAXBElement;

                      import com.oracle.mtom.schema.*;

                      public class MtomServiceClient extends WebServiceGatewaySupport {

                      private ObjectFactory objectFactory;

                      private boolean useWSAddressing = false;

                      private String action;

                      private String to;

                      private String replyTo;

                      public MtomServiceClient(){
                      objectFactory = new ObjectFactory();
                      }

                      public void setUseWSAddressing(boolean value){
                      useWSAddressing = value;
                      }

                      public boolean getUseWSAddressing(){
                      return useWSAddressing;
                      }

                      public void setAction(String value){
                      action = value;
                      }

                      public String getAction(){
                      return action;
                      }

                      public void setTo(String value){
                      to = value;
                      }

                      public String getTo(){
                      return to;
                      }

                      public void setReplyTo(String value){
                      replyTo = value;
                      }

                      public String getReplyTo(){
                      return replyTo;
                      }

                      public void processRequest(String source1, String source2) throws IOException, TransformerException, Exception {

                      JAXBElement responseElement = null;

                      com.oracle.mtom.schema.Package pkg = new com.oracle.mtom.schema.Package();
                      pkg.setPackageTitle("Policy-xyz");
                      pkg.setRecipient1("Insured");
                      pkg.setRecipient2("Agent");
                      pkg.setRecipient3("Carrier");


                      DatatypeFactory factory = DatatypeFactory.newInstance();
                      TimeZone tz = TimeZone.getTimeZone("UTC");
                      GregorianCalendar gc = new GregorianCalendar(tz);
                      pkg.setStartDate(factory.newXMLGregorianCalendar(g c));
                      gc.add(Calendar.DATE, 30); //30 days later
                      pkg.setEndDate(factory.newXMLGregorianCalendar(gc) );


                      //Optional attachment 1
                      if (source1 != null && source1.trim().length() > 0){
                      File f = new File(source1);
                      FileDataSource fd = new FileDataSource(f);
                      DataHandler dh = new DataHandler(fd);
                      Attachment attachment1 = new Attachment();
                      attachment1.setName(f.getName());
                      attachment1.setContent(dh);
                      pkg.getAttachment().add(attachment1);
                      }

                      //Optional attachment 2
                      if (source2 != null && source2.trim().length() > 0){
                      File f = new File(source2);
                      FileDataSource fd = new FileDataSource(f);
                      DataHandler dh = new DataHandler(fd);
                      Attachment attachment2 = new Attachment();
                      attachment2.setName(f.getName());
                      attachment2.setContent(dh);
                      pkg.getAttachment().add(attachment2);
                      }

                      pkg.setOptional1("dummy text");

                      JAXBElement<com.oracle.mtom.schema.Package> request = objectFactory.createTestRequest(pkg );


                      if (useWSAddressing){
                      System.out.println("Using WS-Addressing");
                      ActionCallback myCallback = new ActionCallback(new URI(action), //Action Header
                      new Addressing10(), //Version Header
                      new URI(to)); //To Header

                      myCallback.setReplyTo(new EndpointReference(new URI(replyTo))); //Reply-To Header

                      responseElement = (JAXBElement)getWebServiceTemplate().marshalSendAn dReceive(request, myCallback);

                      }else{
                      System.out.println("Not using WS-Addressing.");

                      responseElement = (JAXBElement)getWebServiceTemplate().marshalSendAn dReceive(request);
                      }

                      if (responseElement != null){
                      PackageResponse rsp = (PackageResponse)responseElement.getValue();
                      System.out.println("Results=<" + rsp.getResults() + ">");
                      System.out.println("ArchiveDate=<" + rsp.getArchiveDate() + ">");
                      }

                      }

                      public static void main(String[] args) throws IOException {
                      try {

                      ApplicationContext ctx = new ClassPathXmlApplicationContext(args[0]);

                      MtomServiceClient mtomServiceClient = (MtomServiceClient) ctx.getBean("MtomServiceClient", MtomServiceClient.class);

                      mtomServiceClient.processRequest(args.length > 1? args[1]: null, args.length > 2? args[2] : null);


                      }catch (Exception e) {
                      e.printStackTrace();
                      }

                      }


                      }

                      continues on the next thread...

                      Comment


                      • #12
                        Here is How to do it with MTOM (part 11)

                        7 - Here is the spring config. file for the client side:

                        <?xml version="1.0" encoding="UTF-8"?>
                        <beans xmlns="http://www.springframework.org/schema/beans"
                        xmlns:sec="http://www.springframework.org/schema/security"
                        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="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
                        <!--A list of colon : separated package names that contain schema derived classes -->
                        <property name="contextPath" value="com.oracle.mtom.schema"/>
                        <!--Enables / disables MTOM -->
                        <property name="mtomEnabled" value="true"/>
                        <!--Used for validation. Cannot validate when MTOM is enabled. -->
                        <!-- <property name="schema" value="schema.xsd"/> -->
                        </bean>


                        <bean id="MtomServiceClient" class="com.oracle.mtom.client.MtomServiceClient">
                        <property name="defaultUri" value="http://localhost:8080/mtomService2"/>

                        <!-- Using STAX instead of SAAJ works but the attachment becomes inline and MTOM is no longer used. -->
                        <!-- <property name="messageFactory" ref="messageFactory"/> -->

                        <property name="marshaller" ref="marshaller"/>
                        <property name="unmarshaller" ref="marshaller"/>

                        </bean>
                        </beans>

                        Comment


                        • #13
                          Here is How to do it with MTOM (part 12)

                          8 - Here is the client side pom.xml file:

                          <?xml version="1.0" encoding="UTF-8"?>
                          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
                          <modelVersion>4.0.0</modelVersion>
                          <groupId>com.oracle.mtom</groupId>
                          <artifactId>mtomServiceClient</artifactId>
                          <packaging>jar</packaging>
                          <version>1.0-SNAPSHOT</version>
                          <name>mtomServiceClient Spring-WS Application</name>
                          <url>http://www.springframework.org/spring-ws</url>
                          <build>
                          <finalName>mtomServiceClient</finalName>
                          <plugins>
                          <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-compiler-plugin</artifactId>
                          <version>2.0.2</version>
                          <configuration>
                          <source>1.5</source>
                          <target>1.5</target>
                          </configuration>
                          </plugin>
                          <plugin>
                          <groupId>org.jvnet.jaxb2.maven2</groupId>
                          <artifactId>maven-jaxb2-plugin</artifactId>
                          <executions>
                          <execution>
                          <goals>
                          <goal>generate</goal>
                          </goals>
                          </execution>
                          </executions>
                          <configuration>
                          <generatePackage>com.oracle.mtom.schema</generatePackage>
                          <schemaDirectory>.</schemaDirectory>
                          </configuration>
                          </plugin>
                          </plugins>
                          </build>
                          <repositories>
                          <repository>
                          <id>maven2-repository.dev.java.net</id>
                          <name>Java.net Maven 2 Repository</name>
                          <url>http://download.java.net/maven/2</url>
                          </repository>
                          <repository>
                          <id>maven-repository.dev.java.net</id>
                          <name>Java.net Maven 1 Repository (legacy)</name>
                          <url>http://download.java.net/maven/1</url>
                          <layout>legacy</layout>
                          </repository>
                          <repository>
                          <id>EclipseLink Repo</id>
                          <url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo</url>
                          </repository>
                          </repositories>
                          <pluginRepositories>
                          <pluginRepository>
                          <id>maven2-repository.dev.java.net</id>
                          <name>Java.net Maven 2 Repository</name>
                          <url>http://download.java.net/maven/2</url>
                          </pluginRepository>
                          <pluginRepository>
                          <id>maven-repository.dev.java.net</id>
                          <name>Java.net Maven 1 Repository (legacy)</name>
                          <url>http://download.java.net/maven/1</url>
                          <layout>legacy</layout>
                          </pluginRepository>
                          </pluginRepositories>
                          <dependencies>
                          <dependency>
                          <groupId>org.springframework.ws</groupId>
                          <artifactId>spring-ws-core-tiger</artifactId>
                          <version>1.5.6</version>
                          <exclusions>
                          <exclusion>
                          <groupId>stax</groupId>
                          <artifactId>stax-api</artifactId>
                          </exclusion>
                          <exclusion>
                          <groupId>wsdl4j</groupId>
                          <artifactId>wsdl4j</artifactId>
                          </exclusion>
                          </exclusions>
                          </dependency>
                          <dependency>
                          <groupId>org.springframework.ws</groupId>
                          <artifactId>spring-oxm-tiger</artifactId>
                          <version>1.5.6</version>
                          <scope>runtime</scope>
                          <exclusions>
                          <exclusion>
                          <groupId>stax</groupId>
                          <artifactId>stax-api</artifactId>
                          </exclusion>
                          </exclusions>
                          </dependency>

                          <dependency>
                          <groupId>javax.mail</groupId>
                          <artifactId>mail</artifactId>
                          <version>1.4</version>
                          </dependency>

                          <dependency>
                          <groupId>javax.activation</groupId>
                          <artifactId>activation</artifactId>
                          <version>1.1</version>
                          </dependency>

                          <!-- JAXB2 -->
                          <!--
                          <dependency>
                          <groupId>javax.xml.bind</groupId>
                          <artifactId>jaxb-api</artifactId>
                          <version>2.1</version>
                          <exclusions>
                          <exclusion>
                          <groupId>javax.xml.stream</groupId>
                          <artifactId>stax-api</artifactId>
                          </exclusion>
                          </exclusions>
                          </dependency>
                          -->

                          <!--
                          <dependency>
                          <groupId>com.sun.xml.bind</groupId>
                          <artifactId>jaxb-impl</artifactId>
                          <version>2.1.5</version>
                          </dependency>
                          -->

                          <!-- EclipseLink JAXB2 interface -->
                          <dependency>
                          <groupId>javax.xml.bind</groupId>
                          <artifactId>javax.xml.bind</artifactId>
                          <version>2.0.0.v20080604-1500</version>
                          </dependency>

                          <!-- EclipseLink JAXB2 implementation -->
                          <dependency>
                          <groupId>org.eclipse.persistence</groupId>
                          <artifactId>eclipselink</artifactId>
                          <version>2.0</version>
                          </dependency>

                          <!--
                          <dependency>
                          <groupId>com.oracle.jaxb</groupId>
                          <artifactId>oracle-jaxb-package</artifactId>
                          <version>1.0-SNAPSHOT</version>
                          </dependency>
                          -->

                          <!-- SAAJ -->
                          <dependency>
                          <groupId>javax.xml.soap</groupId>
                          <artifactId>saaj-api</artifactId>
                          <version>1.3</version>
                          </dependency>

                          <!--Sun's SAAJ implementation. -->

                          <dependency>
                          <groupId>com.sun.xml.messaging.saaj</groupId>
                          <artifactId>saaj-impl</artifactId>
                          <version>1.3</version>
                          </dependency>

                          <!-- Oracle's SAAJ implementation -->
                          <!--
                          <dependency>
                          <groupId>oracle.j2ee.ws.saaj</groupId>
                          <artifactId>orasaaj</artifactId>
                          <version>11.1.1.0.0</version>
                          </dependency>

                          <dependency>
                          <groupId>javax.xml</groupId>
                          <artifactId>xmlparserv2</artifactId>
                          <version>11.1.0.6.0_production</version>
                          </dependency>
                          -->

                          <!-- STAX -->

                          <dependency>
                          <groupId>javanet.staxutils</groupId>
                          <artifactId>stax-utils</artifactId>
                          <version>1.0.1</version>
                          </dependency>

                          <!-- Woodstox STAX -->

                          <dependency>
                          <groupId>woodstox-core-asl</groupId>
                          <artifactId>woodstox-core-asl</artifactId>
                          <version>4.0.3</version>
                          </dependency>

                          <dependency>
                          <groupId>stax2-api</groupId>
                          <artifactId>stax2-api</artifactId>
                          <version>3.0.1</version>
                          </dependency>

                          <!-- Oracle dependencies for ORAWSDL -->
                          <dependency>
                          <groupId>oracle</groupId>
                          <artifactId>orawsdl</artifactId>
                          <version>11.1.1</version>
                          </dependency>

                          <dependency>
                          <groupId>oracle</groupId>
                          <artifactId>oracle_http_client_</artifactId>
                          <version>11.1.1</version>
                          </dependency>

                          <dependency>
                          <groupId>log4j</groupId>
                          <artifactId>log4j</artifactId>
                          <version>1.2.15</version>
                          <exclusions>
                          <exclusion>
                          <groupId>com.sun.jdmk</groupId>
                          <artifactId>jmxtools</artifactId>
                          </exclusion>
                          <exclusion>
                          <groupId>com.sun.jmx</groupId>
                          <artifactId>jmxri</artifactId>
                          </exclusion>
                          </exclusions>
                          </dependency>

                          <!-- WS-Security -->

                          <dependency>
                          <groupId>org.apache.ws.security</groupId>
                          <artifactId>wss4j</artifactId>
                          <version>1.5.6</version>
                          </dependency>

                          <dependency>
                          <groupId>org.springframework.ws</groupId>
                          <artifactId>spring-ws-security</artifactId>
                          <version>1.5.6</version>
                          <exclusions>
                          <exclusion>
                          <groupId>org.acegisecurity</groupId>
                          <artifactId>acegi-security</artifactId>
                          </exclusion>
                          <exclusion>
                          <groupId>com.sun.xml.wss</groupId>
                          <artifactId>xws-security</artifactId>
                          </exclusion>
                          <exclusion>
                          <groupId>javax.xml.crypto.dsig</groupId>
                          <artifactId>xmldsig</artifactId>
                          </exclusion>
                          </exclusions>
                          </dependency>


                          </dependencies>
                          </project>


                          There is another thread in which I posted how to do Validation with MTOM. It is really a workaround for now. Please search 'A Workaround to Validate with MTOM'.
                          Last edited by joe_roberts_z; May 18th, 2009, 04:57 PM.

                          Comment

                          Working...
                          X