Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-904

Improve the experience to enable MTOM with JAXB

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Invalid
    • Affects Version/s: 2.2.1
    • Fix Version/s: None
    • Component/s: Core, Documentation, Samples
    • Labels:
      None

      Description

      I had a very poor experience trying to enable MTOM attachment handling on a receiving endpoint expecting JAXB input parameters. Please let me write the whole story.

      I have to receive web service requests as defined by the following contract: http://www.fatturapa.gov.it/export/fatturazione/sdi/ws/trasmissione/v1.0/TrasmissioneFatture_v1.1.wsdl
      and the imported schema: http://www.fatturapa.gov.it/export/fatturazione/sdi/ws/trasmissione/v1.0/TrasmissioneTypes_v1.1.xsd

      With the following configuration I could make it almost work:

      <?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:web-services="http://www.springframework.org/schema/web-services"
      	xmlns:context="http://www.springframework.org/schema/context"
      	xsi:schemaLocation="http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
      		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
      		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"
      	default-lazy-init="true">
       
      	<context:component-scan base-package="it.dcssrl.fatturapa.sdi" />
      	<web-services:annotation-driven />
       
      	<!-- Expose the TrasmissioneFatture web service - to receive incoming messages from 
      		the SDI -->
      	<web-services:static-wsdl id="TrasmissioneFatture"
      		location="classpath:/wsdl/TrasmissioneFatture_v1.1.wsdl" />
       
      	<bean id="TrasmissioneTypes_v1.1" class="org.springframework.xml.xsd.SimpleXsdSchema">
      		<property name="xsd" value="classpath:/wsdl/TrasmissioneTypes_v1.1.xsd" />
      	</bean>
      </beans>

      @Endpoint
      public class TrasmissioneFattureEndpoint {
       
        @SoapAction("http://www.fatturapa.it/TrasmissioneFatture/RicevutaConsegna")
        public void ricevutaConsegna(@RequestPayload FileSdIType input) {
          // processing
        }

      where FileSdiType is a Java class generated by running the JAXB compiler XJC against the above XSD file. Please note that FileSdiType is annotated with @XmlType and not with XmlRootElement.
      Contrary to what the reference documentation says, unmarshalling for {{FileSdType}

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mauromol Mauro Molinari
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: