[jbossws-dev] [Design of JBoss Web Services] - JBWS-1464 - Adding MTOM support to WSDL To Java - Design

darran.lofthouse@jboss.com do-not-reply at jboss.com
Sat Jan 20 12:15:32 EST 2007


This thread is to discuss the options for adding MTOM support to WSDL To Java.

There are a number of options for how this can be implemented and a number of obstacles to overcome for the more advanced implementations.  The main obstacle is that it is not possible to get access to the expectedContentTypes attribute using the xerces schema API.

On the plus side there currently does not apear to be any work required on generating the JAX RPC mapping file, this just requires a variable mapping (which does not contain type information) in the corresponding java-xml-type-mapping.  This mapping is already correctly generation.

At the moment I see the following options for how this could be implemented: -

1 - Map all binary types to javax.activation.DataHandler

A global configuration option can be set to switch on MTOM mapping and all types that are based on xs:base64Binary or xs:hexBinary can be mapped to javax.activation.DataHandler.

2 - Global configuration to specify what binary types should be mapped to.

A global configuration option can be added to specify what the binary types should be mapped to.  This would assume all binary types can be mapped to the same type.

3 - Allow configuration to map XML types to specific Java types.

This would mean if the schema contains different types based off the binary types then it will be possible for each to be mapped to a different Java type.

This would however not work when the binary types are mapped as follows as it will not be possible to differentiate between them: -

<element name="legacyData" 
  |          xmime:expectedContentTypes="text/xml" 
  |          type="xmime:base64Binary"/>
  | 

4 - A more advanced configuration to allow the specific elements to be identified.


  |   <complexType name='Employee'>
  |      <sequence>
  |         <element name="firstname" type="xsd:string"/>
  |         <element name="lastname" type="xsd:string"/>
  |         <element name="legacyData" xmime:expectedContentTypes="text/xml" 
  |            type="xmime:base64Binary"/>
  |      </sequence>
  |   </complexType>
  | 

So for this example the configuration would allow the user to specify that the element legacyData of the type Employee should be mapped to a specific Java type.

5 - Switch on generation of synthetic annotations.

The xerces implementation has a feature that can be enabled to generate a synthetic annotation when a schema component has non-schema attributes.  This annotation could then be parsed to extract the expectedContentTypes.  This of course would be xerces implementation specific.

An appropriate Java type can then be selected based on the list of content types.

6 - Add a pre-generation step to read mime information from the WSDL

Add a step before generation to read all expectedContentTypes from the schema (Possibly using the synthetic annotations approach), this will store the data in a model - as part of the main generation step this model can be read if a binary type is found to check if mime types have been specified.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004323#4004323

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004323



More information about the jbossws-dev mailing list