axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/encoding TypeMappingImpl.java
Date Fri, 17 Dec 2004 17:00:46 GMT
tomj        2004/12/17 09:00:46

  Modified:    java/src/org/apache/axis AxisEngine.java
               java/src/org/apache/axis/description JavaServiceDesc.java
               java/docs reference.html
               java/src/org/apache/axis/encoding TypeMappingImpl.java
  Log:
  Add a switch to turn on a preference for XML Schema types: "dotNetSoapEncFix"
  
  This addresses Axis-1467:  http://nagoya.apache.org/jira/browse/AXIS-1467
  
  This is a global switch which sets a static flag in the TypeMappingImpl class
  and causes it to skip over SOAP encoded types when looking for the QName
  of a Java class.
  
  Updated the reference guide with the new switch.
  
  Fix a problem in the JavaServiceDesc class where the type mapping
  used by default (for .JWS files for instance) was not the SOAP encoding
  mapping when use=encoded.  For deployed services, we did use the soapenc
  types if they were encoded.  If someone explicitly sets a type mapping, we
  don't mess around with that.
  
  Revision  Changes    Path
  1.116     +18 -0     ws-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- AxisEngine.java	19 Jul 2004 03:03:33 -0000	1.115
  +++ AxisEngine.java	17 Dec 2004 17:00:46 -0000	1.116
  @@ -18,6 +18,7 @@
   
   import org.apache.axis.components.logger.LogFactory;
   import org.apache.axis.encoding.TypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMappingImpl;
   import org.apache.axis.handlers.BasicHandler;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.session.Session;
  @@ -73,6 +74,12 @@
       public static final String PROP_BYTE_BUFFER_RESIDENT_MAX_SIZE = "axis.byteBuffer.residentMaxSize";
       public static final String PROP_BYTE_BUFFER_WORK_BUFFER_SIZE = "axis.byteBuffer.workBufferSize";
       public static final String PROP_EMIT_ALL_TYPES = "emitAllTypesInWSDL";
  +    /**
  +     * Set this property to 'true' when you want Axis to avoid soap encoded
  +     * types to work around a .NET problem where it wont accept soap encoded
  +     * types for a (soap encoded!) array.
  +     */
  +    public static final String PROP_DOTNET_SOAPENC_FIX = "dotNetSoapEncFix";
   
       public static final String DEFAULT_ATTACHMENT_IMPL="org.apache.axis.attachments.AttachmentsImpl";
   
  @@ -169,6 +176,17 @@
                            AxisProperties.getProperty("axis." + PROP_ATTACHMENT_IMPLEMENTATION
 ));
   
           setOptionDefault(PROP_ATTACHMENT_IMPLEMENTATION, DEFAULT_ATTACHMENT_IMPL);
  +
  +        // Check for the property "dotnetsoapencfix" which will turn
  +        // off soap encoded types to work around a bug in .NET where
  +        // it wont accept soap encoded array types.
  +        final Object dotnet = getOption(PROP_DOTNET_SOAPENC_FIX);
  +        if (JavaUtils.isTrue(dotnet)) {
  +            // This is a static property of the type mapping
  +            // that will ignore SOAPENC types when looking up
  +            // QNames of java types.
  +            TypeMappingImpl.dotnet_soapenc_bugfix = true;
  +        }
   
           if (log.isDebugEnabled()) {
               log.debug("Exit: AxisEngine::init");
  
  
  
  1.15      +17 -5     ws-axis/java/src/org/apache/axis/description/JavaServiceDesc.java
  
  Index: JavaServiceDesc.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/description/JavaServiceDesc.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- JavaServiceDesc.java	13 Aug 2004 23:31:28 -0000	1.14
  +++ JavaServiceDesc.java	17 Dec 2004 17:00:46 -0000	1.15
  @@ -19,10 +19,7 @@
   import org.apache.axis.Constants;
   import org.apache.axis.InternalException;
   import org.apache.axis.components.logger.LogFactory;
  -import org.apache.axis.encoding.DefaultTypeMappingImpl;
  -import org.apache.axis.encoding.TypeMapping;
  -import org.apache.axis.encoding.TypeMappingRegistry;
  -import org.apache.axis.encoding.TypeMappingRegistryImpl;
  +import org.apache.axis.encoding.*;
   import org.apache.axis.enum.Style;
   import org.apache.axis.enum.Use;
   import org.apache.axis.message.SOAPBodyElement;
  @@ -143,7 +140,11 @@
       private ArrayList completedNames = new ArrayList();
   
       /** Our typemapping for resolving Java<->XML type issues */
  -    private TypeMapping tm = DefaultTypeMappingImpl.getSingleton();
  +    private TypeMapping tm = DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
  +
  +    // If someone has explicitly set the type mapping, don't mess with it
  +    // when use is set.
  +    private boolean tmSet = false;
   
       private TypeMappingRegistry tmr = null;
   
  @@ -169,6 +170,11 @@
           if (!useSet) {
               // Use hasn't been explicitly set, so track style
               use = style == Style.RPC ? Use.ENCODED : Use.LITERAL;
  +            if (!tmSet && use == Use.ENCODED && ! (tm instanceof DefaultSOAPEncodingTypeMappingImpl))
{
  +                tm = DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
  +            } else {
  +                tm = DefaultTypeMappingImpl.getSingleton();
  +            }
           }
       }
   
  @@ -183,6 +189,11 @@
       public void setUse(Use use) {
           useSet = true;
           this.use = use;
  +        if (!tmSet && use == Use.ENCODED && ! (tm instanceof DefaultSOAPEncodingTypeMappingImpl))
{
  +            tm = DefaultSOAPEncodingTypeMappingImpl.createWithDelegate();
  +        } else {
  +            tm = DefaultTypeMappingImpl.getSingleton();
  +        }
       }
   
       /**
  @@ -296,6 +307,7 @@
       }
   
       public void setTypeMapping(TypeMapping tm) {
  +        tmSet = true;
           this.tm = tm;
       }
   
  
  
  
  1.39      +20 -1     ws-axis/java/docs/reference.html
  
  Index: reference.html
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/docs/reference.html,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- reference.html	4 Nov 2004 13:38:12 -0000	1.38
  +++ reference.html	17 Dec 2004 17:00:46 -0000	1.39
  @@ -752,7 +752,18 @@
   which supports parameter name/value pairs as nested elements. Here are
   the options that we currently document, though there may be more
   (consult the source, as usual). </p>
  -<pre>&lt;globalConfiguration&gt;<br>    &lt;parameter name="adminPassword"
value="admin"/&gt;<br>    &lt;parameter name="attachments.Directory" value="c:\temp\attachments"/&gt;<br>
   &lt;parameter name="sendMultiRefs" value="true"/&gt;<br>    &lt;parameter
name="sendXsiTypes" value="true"/&gt;<br>    &lt;parameter name="attachments.implementation"
value="org.apache.axis.attachments.AttachmentsImpl"/&gt;<br>    &lt;parameter
name="sendXMLDeclaration" value="true"/&gt;<br>    &lt;parameter name="enable2DArrayEncoding"
value="true"/&gt;<br>&lt;/globalConfiguration&gt;<br></pre>
  +<pre>
  +&lt;globalConfiguration&gt;
  +    &lt;parameter name="adminPassword" value="admin"/&gt;
  +    &lt;parameter name="attachments.Directory" value="c:\temp\attachments"/&gt;
  +    &lt;parameter name="sendMultiRefs" value="true"/&gt;
  +    &lt;parameter name="sendXsiTypes" value="true"/&gt;
  +    &lt;parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/&gt;

  +    &lt;parameter name="sendXMLDeclaration" value="true"/&gt;
  +    &lt;parameter name="enable2DArrayEncoding" value="true"/&gt;
  +    &lt;parameter name="dotnetsoapencfix" value="false"/&gt;
  +&lt;/globalConfiguration&gt;
  +</pre>
   <table>
     <tbody>
       <tr>
  @@ -848,6 +859,14 @@
         <td><b>use-servlet-security</b></td>
         <td>Set this flag to hand authentication off to the servlet
   container. </td>
  +    </tr>
  +    <tr>
  +      <td><b>DotNetSoapEncFix</b></td>
  +      <td>Set this flag to true to turn on a preference for the XML Schema (xsd)
types in the
  +	  Axis engine.  This improved interop with .NET. In particular, .NET seems to have problems
  +	  accepting SOAP encoded types (soapenc) in arrays.  Due to bugs in the Axis 1.1 type
mapping
  +	  system, Axis generally perferred the schema types.  Axis 1.2 now correctly uses the
SOAP
  +	  encoded types when it is using SOAP encoding for a service.  See JAX-RPC 1.1, section
4.2.1. </td>
       </tr>
   <!-- end table -->
     </tbody>
  
  
  
  1.54      +20 -0     ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java
  
  Index: TypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- TypeMappingImpl.java	15 Dec 2004 12:15:52 -0000	1.53
  +++ TypeMappingImpl.java	17 Dec 2004 17:00:46 -0000	1.54
  @@ -19,6 +19,7 @@
   import org.apache.axis.Constants;
   import org.apache.axis.AxisProperties;
   import org.apache.axis.MessageContext;
  +import org.apache.axis.AxisEngine;
   import org.apache.axis.components.logger.LogFactory;
   import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
   import org.apache.axis.encoding.ser.ArraySerializerFactory;
  @@ -72,6 +73,14 @@
       protected static Log log =
           LogFactory.getLog(TypeMappingImpl.class.getName());
   
  +    /**
  +     * Work around a .NET bug with soap encoded types.
  +     * This is a static property of the type mapping that will
  +     * cause the class to ignore SOAPENC types when looking up
  +     * QNames of java types.  See getTypeQNameExact().
  +     */
  +    public static boolean dotnet_soapenc_bugfix = false;
  +
       public static class Pair {
           public Class javaType;
           public QName xmlType;
  @@ -547,6 +556,17 @@
          
           QName xmlType = null;
           Pair pair = (Pair) class2Pair.get(javaType);
  +        if (dotnet_soapenc_bugfix && pair != null ) {
  +            // Hack alert!
  +            // If we are in .NET bug compensation mode, skip over any
  +            // SOAP Encoded types we my find and prefer XML Schema types
  +            xmlType = pair.xmlType;
  +            if (Constants.isSOAP_ENC(xmlType.getNamespaceURI()) &&
  +                    !xmlType.getLocalPart().equals("Array")) {
  +                pair = null;
  +            }
  +        }
  +
           if (pair == null && delegate != null) {
               xmlType = delegate.getTypeQNameExact(javaType);
           } else if (pair != null) {
  
  
  

Mime
View raw message