axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java JavaSkelWriter.java
Date Mon, 22 Jul 2002 15:17:35 GMT
scheu       2002/07/22 08:17:35

  Modified:    java/src/org/apache/axis/encoding
                        DefaultTypeMappingImpl.java
               java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
                        JavaSkelWriter.java
  Log:
  Two fixes necessary to pass TCK tests.
  These fixes may also correct some problems reported in Bugzilla.
  
  First Problem:
    Echoing a hexBinary does not work.  Passing the byte[] from the client to
    the server works correctly  because the stub indicates
    the parameter typeQName is xsd:hexBinary;
    thus the byte[] is serialized as a xsd:hexBinary
    instead of the default xsd:base64.
  
    Returning the byte[] back to the client does not work because the
    wsdd operation does not know the proper returnType QName.
    The byte[] is serialized back to the client as a xsd:base64.
  
    The solution is to have the returnType attribute generated in the
    deploy.wsdd and Skeleton...just like we do for parameters.
  
  Second Problem:
    The TCK wants to echo a collection of xsd:byte using a javaType of byte[].
    The problem is byte[] is mapped to xsd:base64, so the serialization
    and deserialization is incorrect.  The solution is to add the special
    case of (xsd:byte, byte[]) to the default type mapping so that serialization
    occurs correctly (serialize a series of bytes) and deserialization works
    correctly (deserialize individual bytes).
  
  Revision  Changes    Path
  1.37      +14 -1     xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
  
  Index: DefaultTypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DefaultTypeMappingImpl.java	18 Jul 2002 17:38:15 -0000	1.36
  +++ DefaultTypeMappingImpl.java	22 Jul 2002 15:17:34 -0000	1.37
  @@ -157,6 +157,20 @@
           // byte[] -ser-> XSD_BASE64
           // XSD_BASE64 -deser-> byte[]
           // SOAP_BASE64 -deser->byte[]
  +        // 
  +        // Special case:
  +        // If serialization is requested for xsd:byte with byte[],
  +        // the array serializer is used.  If deserialization
  +        // is specifically requested for xsd:byte with byte[], the
  +        // simple deserializer is used.  This is necessary 
  +        // to support the serialization/deserialization 
  +        // of <element name="a" type="xsd:byte" maxOccurs="unbounded" />
  +        // as discrete bytes without interference with XSD_BASE64.
  +        myRegister(Constants.XSD_BYTE,       byte[].class,
  +                   new ArraySerializerFactory(),
  +                   null,
  +                   false);
  +
           myRegister(Constants.SOAP_BASE64,     byte[].class,
                      new Base64SerializerFactory(byte[].class,
                                                  Constants.SOAP_BASE64 ),
  @@ -237,7 +251,6 @@
                      null, null,true);
           myRegister(Constants.XSD_BYTE,       byte.class,
                      null, null,true);
  -
   
           // Map QNAME to the jax rpc QName class
           myRegister(Constants.XSD_QNAME,
  
  
  
  1.52      +24 -1     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
  
  Index: JavaDeployWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- JavaDeployWriter.java	20 Jul 2002 00:30:20 -0000	1.51
  +++ JavaDeployWriter.java	22 Jul 2002 15:17:35 -0000	1.52
  @@ -340,6 +340,7 @@
                           symbolTable.getOperationParameters(operation, "", bEntry);
                   if (params != null) {
                       QName returnQName = null;
  +                    QName returnType = null;
                       
                       // Get the operation QName
                       QName elementQName = Utils.getOperationQName(bindingOper);
  @@ -348,8 +349,24 @@
                       if (params.returnName != null)
                           returnQName = params.returnName;
   
  +                    TypeEntry returnTE = params.returnType;
  +                    if (returnTE != null &&
  +                        returnTE instanceof DefinedElement &&
  +                        returnTE.getRefType() != null) {
  +                        returnTE = returnTE.getRefType();
  +                    } 
  +                    if (returnTE != null &&
  +                        returnTE instanceof CollectionType &&
  +                        returnTE.getRefType() != null) {
  +                        returnTE = returnTE.getRefType();
  +                    }
  +                    if (returnTE != null) {
  +                        returnType = returnTE.getQName();
  +                    }
  +
                       // Write the operation metadata
  -                    writeOperation(pw, javaOperName, elementQName, returnQName,
  +                    writeOperation(pw, javaOperName, elementQName, 
  +                                   returnQName, returnType,
                                      params);
                   }
               }
  @@ -375,6 +392,7 @@
                                     String javaOperName,
                                     QName elementQName,
                                     QName returnQName,
  +                                  QName returnType,
                                     Parameters params) {
           pw.print("      <operation name=\"" + javaOperName + "\"");
           if (elementQName != null) {
  @@ -385,6 +403,11 @@
           if (returnQName != null) {
               pw.print(" returnQName=\"" +
                        Utils.genQNameAttributeString(returnQName, "retNS") +
  +                     "\"");
  +        }
  +        if (returnType != null) {
  +            pw.print(" returnType=\"" +
  +                     Utils.genQNameAttributeString(returnType, "rtns") +
                        "\"");
           }
           pw.println(" >");
  
  
  
  1.36      +18 -1     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java
  
  Index: JavaSkelWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- JavaSkelWriter.java	20 Jul 2002 00:30:20 -0000	1.35
  +++ JavaSkelWriter.java	22 Jul 2002 15:17:35 -0000	1.36
  @@ -75,8 +75,8 @@
   import javax.xml.namespace.QName;
   
   import org.apache.axis.wsdl.symbolTable.BindingEntry;
  -import org.apache.axis.wsdl.symbolTable.Element;
   import org.apache.axis.wsdl.symbolTable.CollectionType;
  +import org.apache.axis.wsdl.symbolTable.Element;
   import org.apache.axis.wsdl.symbolTable.Parameter;
   import org.apache.axis.wsdl.symbolTable.Parameters;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
  @@ -221,6 +221,23 @@
                   }
                   pw.println("        _oper = new org.apache.axis.description.OperationDesc(\""
+
                               javaOpName + "\", _params, " + returnStr + ");");
  +
  +                // Set the return type QName
  +                TypeEntry returnTE = parameters.returnType;
  +                if (returnTE != null &&
  +                    returnTE instanceof Element &&
  +                    returnTE.getRefType() != null) {
  +                    returnTE = returnTE.getRefType();
  +                } 
  +                if (returnTE != null &&
  +                    returnTE instanceof CollectionType &&
  +                    returnTE.getRefType() != null) {
  +                    returnTE = returnTE.getRefType();
  +                }
  +                if (returnTE != null) {
  +                    pw.println("        _oper.setReturnType(" +
  +                               Utils.getNewQName(returnTE.getQName()) + ");");
  +                }
   
                   // If we need to know the QName (if we have a namespace or
                   // the actual method name doesn't match the XML we expect),
  
  
  

Mime
View raw message