gdaniels    02/03/08 12:04:46

  Modified:    java/src/org/apache/axis/description AttributeDesc.java
                        TypeDesc.java
               java/src/org/apache/axis/encoding/ser BeanSerializer.java
               java/src/org/apache/axis/message RPCElement.java
               java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
               java/test/wsdl/wrapped CityBBBBindingImpl.java
                        CityBBBTestCase.java
  Log:
  Fix a couple of wrapped-style bugs.
  
  1) RPCElement should treat "wrapped" as isRPC when serializing, so we
      write the wrapper element ("wrapped", get it? :))
  
  2) DeployWriter wasn't writing the "style='wrapped'" attribute into the
      deploy.wsdd
  
  Also a little more work on the AttributeDesc/TypeDesc stuff, and
  emit more reasonable schema from BeanSerializer
  
  Revision  Changes    Path
  1.2       +12 -0     xml-axis/java/src/org/apache/axis/description/AttributeDesc.java
  
  Index: AttributeDesc.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/description/AttributeDesc.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AttributeDesc.java        8 Mar 2002 05:04:53 -0000       1.1
  +++ AttributeDesc.java        8 Mar 2002 20:04:45 -0000       1.2
  @@ -54,6 +54,8 @@
    */
   package org.apache.axis.description;
   
  +import javax.xml.rpc.namespace.QName;
  +
   /**
    * An AttributeDesc is a FieldDesc for an Java field mapping to an
    * XML attribute
  @@ -63,5 +65,15 @@
   public class AttributeDesc extends FieldDesc {
       public AttributeDesc() {
           super(false);
  +    }
  +
  +    /**
  +     * Set the XML attribute's name, without giving it a namespace.
  +     *
  +     * This is the most common usage for AttributeDescs.
  +     */
  +    public void setAttributeName(String name)
  +    {
  +        setXmlName(new QName("", name));
       }
   }
  
  
  
  1.4       +5 -1      xml-axis/java/src/org/apache/axis/description/TypeDesc.java
  
  Index: TypeDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/TypeDesc.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TypeDesc.java     8 Mar 2002 14:12:13 -0000       1.3
  +++ TypeDesc.java     8 Mar 2002 20:04:45 -0000       1.4
  @@ -177,7 +177,11 @@
           FieldDesc desc = (FieldDesc)fieldNameMap.get(fieldName);
           if (desc == null || desc.isElement())
               return null;
  -        return desc.getXmlName();
  +        QName ret = desc.getXmlName();
  +        if (ret == null) {
  +            ret = new QName("", fieldName);
  +        }
  +        return ret;
       }
   
       /**
  
  
  
  1.16      +16 -9     
xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java
  
  Index: BeanSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- BeanSerializer.java       8 Mar 2002 14:12:13 -0000       1.15
  +++ BeanSerializer.java       8 Mar 2002 20:04:45 -0000       1.16
  @@ -380,27 +380,34 @@
           Vector fields = clsRep.getFields();
           for (int i=0; i < fields.size(); i++) {
               FieldRep field = (FieldRep) fields.elementAt(i);
  -            
  +
  +            String name = field.getName();
  +
               if (typeDesc != null) {
                   FieldDesc fieldDesc = typeDesc.getFieldByName(field.getName());
                   if (fieldDesc != null) {
                       if (!fieldDesc.isElement()) {
  -                        // !!! Need to get the QName right, and can only
  -                        //     pass strings???
  -                        writeAttribute(types, field.getName(),
  +                        QName attrName = typeDesc.getAttributeNameForField(
  +                                                    field.getName());
  +                        writeAttribute(types, attrName.getLocalPart(),
                                          field.getType(), 
                                          complexType);
                       } else {
  -                        // MEN WORKING!!!!
  +                        QName xmlName = typeDesc.getElementNameForField(
  +                                field.getName());
  +                        if (xmlName != null) {
  +                            if (xmlName.getNamespaceURI() != "") {
  +                                // Throw an exception until we can emit
  +                                // schema for this correctly?
  +                            }
  +                            name = xmlName.getLocalPart();
  +                        }
                       }
                       return true;
                   }
               }
   
  -            writeField(types, field.getName(), 
  -                       field.getType(), 
  -                       field.getIndexed(), 
  -                       all);
  +            writeField(types, name, field.getType(), field.getIndexed(), all);
           }
           // done
           return true;
  
  
  
  1.42      +1 -1      xml-axis/java/src/org/apache/axis/message/RPCElement.java
  
  Index: RPCElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCElement.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- RPCElement.java   8 Mar 2002 19:29:43 -0000       1.41
  +++ RPCElement.java   8 Mar 2002 20:04:45 -0000       1.42
  @@ -246,7 +246,7 @@
           boolean isRPC = true;
           if (msgContext != null &&
                   (msgContext.getOperationStyle() != ServiceDesc.STYLE_RPC) &&
  -                ! msgContext.isPropertyTrue("wrapped")) {
  +                (msgContext.getOperationStyle() != ServiceDesc.STYLE_WRAPPED)) {
                   isRPC = false;
           }
   
  
  
  
  1.25      +13 -3     
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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- JavaDeployWriter.java     6 Mar 2002 18:50:51 -0000       1.24
  +++ JavaDeployWriter.java     8 Mar 2002 20:04:45 -0000       1.25
  @@ -187,7 +187,7 @@
                   if (type.getName().endsWith("[]")) {
                       pw.println("        
serializer=\"org.apache.axis.encoding.ser.ArraySerializerFactory\"");
                       pw.println("        
deserializer=\"org.apache.axis.encoding.ser.ArrayDeserializerFactory\"");
  -                } else if (type.getNode() != null && 
  +                } else if (type.getNode() != null &&
                      SchemaUtils.getEnumerationBaseAndValues(
                        type.getNode(), emitter.getSymbolTable()) != null) {
                       pw.println("        
serializer=\"org.apache.axis.encoding.ser.EnumSerializerFactory\"");
  @@ -206,7 +206,7 @@
                       pw.println("        encodingStyle=\"\"");
                   else
                       pw.println("        encodingStyle=\"" + 
Constants.URI_CURRENT_SOAP_ENC + "\"");
  -                
  +
                   pw.println("      />");
               }
           }
  @@ -223,9 +223,19 @@
           boolean hasLiteral = bEntry.hasLiteral();
   
           String prefix = Constants.NSPREFIX_WSDD_JAVA;
  +        String styleStr = "";
  +
  +        if (hasLiteral) {
  +            styleStr = " style=\"document\"";
  +        }
  +
  +        if (symbolTable.isWrapped()) {
  +            styleStr = " style=\"wrapped\"";
  +        }
  +
           pw.println("  <service name=\"" + serviceName
                   + "\" provider=\"" + prefix +":RPC"
  -                + "\"" + (hasLiteral ? " style=\"document\"" : "") + ">");
  +                + "\"" + styleStr + ">");
   
           writeDeployBinding(binding);
           writeDeployTypes(hasLiteral);
  
  
  
  1.2       +5 -5      xml-axis/java/test/wsdl/wrapped/CityBBBBindingImpl.java
  
  Index: CityBBBBindingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/wrapped/CityBBBBindingImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CityBBBBindingImpl.java   8 Mar 2002 17:22:13 -0000       1.1
  +++ CityBBBBindingImpl.java   8 Mar 2002 20:04:45 -0000       1.2
  @@ -8,10 +8,11 @@
   package test.wsdl.wrapped;
   
   public class CityBBBBindingImpl implements CityBBBBinding {
  -    public GetAttractionResponse getAttraction(GetAttraction getAttraction) throws 
java.rmi.RemoteException {
  -        GetAttractionResponse response = new GetAttractionResponse();
  +    public static final String OID_STRING = "Attraction@cityCF::1028:1028";
  +
  +    public Attraction getAttraction(String attname) throws java.rmi.RemoteException 
{
           Attraction attraction = new Attraction();
  -        attraction.setOID("Attraction@cityCF::1028:1028");
  +        attraction.setOID(OID_STRING);
           attraction.setFacts("New Orleans at Christmastime is a city with the best 
food in the world, the best music" +
                               " in the world, international shopping, the French 
Quarter -- America&apos;s most " +
                               " romantic neighborhood, and the friendliest, most 
big-hearted people you&apos;d ever " +
  @@ -40,7 +41,6 @@
                               " a proof for the existence of heaven. And as every New 
Orleanian knows, Heaven is " +
                               " presided over by a French-Italian-Creole chef with a 
gumbo-pot belly and a laugh " +
                               " that fills that human heart with gladness. Merry 
Christmas to ya, New Orleans style.");
  -        response.set_return(attraction);
  -        return response;
  +        return attraction;
       }
   }
  
  
  
  1.2       +3 -5      xml-axis/java/test/wsdl/wrapped/CityBBBTestCase.java
  
  Index: CityBBBTestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/wrapped/CityBBBTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CityBBBTestCase.java      8 Mar 2002 17:22:13 -0000       1.1
  +++ CityBBBTestCase.java      8 Mar 2002 20:04:45 -0000       1.2
  @@ -22,11 +22,9 @@
           assertTrue("binding is null", binding != null);
   
           try {
  -            GetAttractionResponse value = null;
  -            GetAttraction request = new GetAttraction();
  -            request.setAttname("Christmas");
  -            value = binding.getAttraction(request);
  -            System.out.println("OID:" + value.get_return().getOID());
  +            Attraction value = binding.getAttraction("Christmas");
  +            assertEquals("OID value was wrong", value.getOID(),
  +                         CityBBBBindingImpl.OID_STRING);
           }
           catch (java.rmi.RemoteException re) {
               throw new junit.framework.AssertionFailedError("Remote Exception 
caught: " + re);
  
  
  


Reply via email to