axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl/wrapped CityBBB.wsdl CityBBBBindingImpl.java CityBBBTestCase.java
Date Fri, 08 Mar 2002 17:22:14 GMT
dims        02/03/08 09:22:14

  Modified:    java/src/org/apache/axis/encoding/ser BeanDeserializer.java
               java/src/org/apache/axis/message RPCElement.java
               java/src/org/apache/axis/wsdl/toJava SymbolTable.java
               java/test/wsdl Wsdl2javaTestSuite.xml
  Added:       java/test/wsdl/wrapped CityBBB.wsdl CityBBBBindingImpl.java
                        CityBBBTestCase.java
  Log:
  - Fixed BeanDeserializer to use the propertyMap instead of the array.
  - Fixed RPCElement to set elementIsFirstParam=true for the STYLE_WRAPPED style.
  - Fixed SymbolTable to generate correct code for "wrapped" request.
  - Add "wrapped" sample to test the code and make sure it does not break in the future.
  
  Revision  Changes    Path
  1.10      +9 -10     xml-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java
  
  Index: BeanDeserializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- BeanDeserializer.java	8 Mar 2002 14:12:13 -0000	1.9
  +++ BeanDeserializer.java	8 Mar 2002 17:22:13 -0000	1.10
  @@ -101,7 +101,6 @@
   
       QName xmlType;
       Class javaType;
  -    private BeanPropertyDescriptor[] pd = null;
       private HashMap propertyMap = new HashMap();
       
       /** Type metadata about this class for XML deserialization */
  @@ -115,11 +114,12 @@
           this.xmlType = xmlType;
           this.javaType = javaType;
           // Get a list of the bean properties
  -        this.pd = BeanSerializer.getPd(javaType);
  +        BeanPropertyDescriptor[] pd = BeanSerializer.getPd(javaType);
           // loop through properties and grab the names for later
           for (int i = 0; i < pd.length; i++) {
               BeanPropertyDescriptor descriptor = pd[i];
               propertyMap.put(descriptor.getName(), descriptor);
  +            propertyMap.put(JavaUtils.xmlNameToJava(descriptor.getName()), descriptor);
           }
   
           typeDesc = TypeDesc.getTypeDescForClass(javaType);
  @@ -172,14 +172,13 @@
                       BeanSerializer.format(localName, 
                                             BeanSerializer.FORCE_LOWER);
               String mangledName = JavaUtils.xmlNameToJava(localName);
  -            for (int i=0; i<pd.length; i++) {
  -                if (pd[i].getWriteMethod() == null ) continue ;
  -                if (pd[i].getName().equals(localNameUp) ||
  -                        pd[i].getName().equals(localNameLo) ||
  -                        pd[i].getName().equals(mangledName)) {
  -                    propDesc = pd[i];
  -                }
  -            }
  +            propDesc = (BeanPropertyDescriptor) propertyMap.get(localName);
  +            if(propDesc == null)
  +                propDesc = (BeanPropertyDescriptor) propertyMap.get(localNameUp);
  +            if(propDesc == null)
  +                propDesc = (BeanPropertyDescriptor) propertyMap.get(localNameLo);
  +            if(propDesc == null)
  +                propDesc = (BeanPropertyDescriptor) propertyMap.get(mangledName);
           }
           
           if (propDesc == null) {
  
  
  
  1.40      +2 -2      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.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- RPCElement.java	5 Mar 2002 14:02:13 -0000	1.39
  +++ RPCElement.java	8 Mar 2002 17:22:13 -0000	1.40
  @@ -99,8 +99,8 @@
   
               // IF we're doc/literal... we can't count on the element name
               // being the method name.
  -            elementIsFirstParam = (operation.getStyle() ==
  -                                   ServiceDesc.STYLE_DOCUMENT);
  +            elementIsFirstParam = ( (operation.getStyle() == ServiceDesc.STYLE_DOCUMENT)
||
  +                                    (operation.getStyle() == ServiceDesc.STYLE_WRAPPED));
           }
       }
       
  
  
  
  1.40      +8 -16     xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- SymbolTable.java	3 Mar 2002 14:09:08 -0000	1.39
  +++ SymbolTable.java	8 Mar 2002 17:22:13 -0000	1.40
  @@ -1121,22 +1121,14 @@
               if (node == null)
                   continue;  // ??? Skip this part, something is wrong
               
  -            // Get the nested type entries.
  -            Vector vTypes = 
  -                    SchemaUtils.getComplexElementTypesAndNames(node, this);
  -            
  -            if (vTypes != null) {
  -                // add the elements in this list
  -                v.addAll(vTypes);
  -            } else {
  -                // XXX - This should be a SOAPElement/SOAPBodyElement
  -                if (typeName != null) {
  -                    v.add(getType(typeName));
  -                    v.add(partName);
  -                } else if (elementName != null) {
  -                    v.add(getElement(elementName));
  -                    v.add(partName);
  -                }
  +            if (typeName != null) {
  +                v.add(getType(typeName));
  +                v.add(partName);
  +            } else if (elementName != null) {
  +                Element element = getElement(elementName);
  +                element.setIsReferenced(true);
  +                v.add(element);
  +                v.add(partName);
               }
           } // while
           
  
  
  
  1.86      +18 -9     xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
  
  Index: Wsdl2javaTestSuite.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- Wsdl2javaTestSuite.xml	6 Mar 2002 20:39:40 -0000	1.85
  +++ Wsdl2javaTestSuite.xml	8 Mar 2002 17:22:13 -0000	1.86
  @@ -11,12 +11,12 @@
       </fileset>
     </path>
   
  -  <taskdef name="wsdl2java" 
  +  <taskdef name="wsdl2java"
              classname="test.wsdl.Wsdl2javaAntTask">
         <classpath refid="test-classpath" />
     </taskdef>
   
  -  <taskdef name="java2wsdl" 
  +  <taskdef name="java2wsdl"
              classname="test.wsdl.Java2WsdlAntTask">
         <classpath refid="test-classpath" />
     </taskdef>
  @@ -135,7 +135,7 @@
           <mapping namespace="http://roundtrip.wsdl.test" package="test.wsdl.roundtrip"/>
       </java2wsdl>
   
  - 
  +
       <!-- Delete the intermediate files so we recreate over a clean slate -->
       <delete dir="${build.dir}/classes/test/wsdl/roundtrip"/>
       <!-- Recreate Java files from the new WSDL -->
  @@ -249,7 +249,7 @@
                  testcase="no">
           <mapping namespace="urn:InheritanceTest2" package="test.wsdl.inheritance"/>
       </wsdl2java>
  -    
  +
       <!-- inheritance test (cont): Test the stopClass and exclude switches -->
       <!-- Compile class files -->
       <javac srcdir="${test.dir}/wsdl/inheritance" destdir="${build.dest}" debug="${debug}">
  @@ -268,7 +268,7 @@
                  location="http://localhost:8080/axis/services/StopExcludeTest">
           <mapping namespace="urn:InheritanceTest3" package="test.wsdl.inheritance"/>
       </java2wsdl>
  -    
  +
   
       <!-- MArrayTests Test -->
       <wsdl2java url="test/wsdl/marrays/MArrayTest.wsdl"
  @@ -297,6 +297,15 @@
           <mapping namespace="urn:Nested" package="test.wsdl.nested"/>
       </wsdl2java>
   
  +    <!-- Wrapped Sample Test -->
  +    <wsdl2java url="test/wsdl/wrapped/CityBBB.wsdl"
  +               output="build/work"
  +               deployscope="session"
  +               serverSide="yes"
  +               testcase="yes">
  +        <mapping namespace="urn:CityBBB" package="test.wsdl.wrapped"/>
  +    </wsdl2java>
  +
       <!-- Import Test 1:  some namespace->package mappings from the -->
       <!--                 command line, some generated, some from   -->
       <!--                 NStoPkg.properties.                       -->
  @@ -664,7 +673,7 @@
                  testcase="no">
           <mapping namespace="http://test.com/reference" package="test.wsdl.filegen"/>
       </wsdl2java>
  -    
  +
       <!-- Same test as above but this time the -a flag is turned on -->
       <wsdl2java url="test/wsdl/filegen/FileGen.wsdl"
                  output="build/work"
  @@ -672,7 +681,7 @@
                  all="yes">
           <mapping namespace="http://test.com/reference" package="test.wsdl.filegenAll"/>
       </wsdl2java>
  -    
  +
       <!-- Check to make sure we map XML names that are illegal Java correctly -->
       <wsdl2java url="test/wsdl/names/JavaNames.wsdl"
                  output="build/work"
  @@ -699,7 +708,7 @@
       </wsdl2java>
   
       <!-- This tests .NET document/literal WSDL.
  -         We get this WSDL file from the internet on purpose, 
  +         We get this WSDL file from the internet on purpose,
            file is only for reference.
        -->
       <!-- <wsdl2java url="http://www.perfectxml.net/WebServices/SalesRankNPrice/BookService.asmx?WSDL"
-->
  @@ -709,7 +718,7 @@
                  serverSide="no"
                  testcase="no">
           <mapping namespace="http://www.PerfectXML.com/NETWebSvcs/BookService" package="test.wsdl.literal"/>
  -               
  +
       </wsdl2java>
       <!-- The following WSDL are BAD.  We're keeping them here so we can -->
       <!-- check periodically to see whether the owner has fixed them.    -->
  
  
  
  1.1                  xml-axis/java/test/wsdl/wrapped/CityBBB.wsdl
  
  Index: CityBBB.wsdl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <definitions name="City_BBB" targetNamespace="urn:CityBBB"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="urn:CityBBB" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <types>
      <xsd:schema attributeFormDefault="qualified"
      elementFormDefault="qualified" targetNamespace="urn:CityBBB">
        <xsd:element name="getAttraction">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element maxOccurs="1" minOccurs="0" name="attname"
              type="xsd:string" />
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
  
        <xsd:element name="getAttractionResponse">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element maxOccurs="1" minOccurs="0" name="_return"
              type="tns:Attraction" />
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
  
        <xsd:complexType name="Attraction">
          <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="0" name="_OID"
            type="xsd:string" />
  
            <xsd:element maxOccurs="1" minOccurs="0" name="name"
            type="xsd:string" />
  
            <xsd:element maxOccurs="1" minOccurs="0" name="rating"
            type="xsd:string" />
  
            <xsd:element maxOccurs="1" minOccurs="0" name="price"
            type="xsd:string" />
  
            <xsd:element maxOccurs="1" minOccurs="0" name="hours"
            type="xsd:string" />
  
            <xsd:element maxOccurs="1" minOccurs="0" name="facts"
            type="xsd:string" />
  
            <xsd:element maxOccurs="1" minOccurs="0"
            name="modifyDate" type="xsd:date" />
  
            <xsd:element maxOccurs="1" minOccurs="0" name="vendor"
            type="tns:Vendor" />
  
            <xsd:element maxOccurs="1" minOccurs="0" name="map"
            type="tns:Bitmap" />
  
            <xsd:element maxOccurs="1" minOccurs="0"
            name="background" type="tns:Bitmap" />
  
            <xsd:element maxOccurs="1" minOccurs="0" name="soundClip"
            type="tns:Audio" />
  
            <xsd:element maxOccurs="unbounded" minOccurs="0"
            name="categories" type="tns:Category" />
  
            <xsd:element maxOccurs="unbounded" minOccurs="0"
            name="animation" type="tns:Bitmap" />
  
            <xsd:element maxOccurs="unbounded" minOccurs="0"
            name="media" type="tns:MediaData" />
  
            <xsd:element maxOccurs="1" minOccurs="0" name="address"
            type="tns:Address" />
          </xsd:sequence>
        </xsd:complexType>
  
        <xsd:complexType name="Vendor">
          <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="0" name="_OID"
            type="xsd:string" />
          </xsd:sequence>
        </xsd:complexType>
  
        <xsd:complexType name="Bitmap">
          <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="0" name="_OID"
            type="xsd:string" />
          </xsd:sequence>
        </xsd:complexType>
  
        <xsd:complexType name="Audio">
          <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="0" name="_OID"
            type="xsd:string" />
          </xsd:sequence>
        </xsd:complexType>
  
        <xsd:complexType name="Category">
          <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="0" name="_OID"
            type="xsd:string" />
          </xsd:sequence>
        </xsd:complexType>
  
        <xsd:complexType name="MediaData">
          <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="0" name="_OID"
            type="xsd:string" />
          </xsd:sequence>
        </xsd:complexType>
  
        <xsd:complexType name="Address">
          <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="0" name="_OID"
            type="xsd:string" />
          </xsd:sequence>
        </xsd:complexType>
      </xsd:schema>
    </types>
  
    <message name="getAttractionIn">
      <part element="tns:getAttraction" name="parameters" />
    </message>
  
    <message name="getAttractionOut">
      <part element="tns:getAttractionResponse" name="parameters" />
    </message>
  
    <portType name="City_BBBPortType">
      <operation name="getAttraction">
        <input message="tns:getAttractionIn" />
  
        <output message="tns:getAttractionOut" />
      </operation>
    </portType>
  
    <binding name="City_BBBBinding" type="tns:City_BBBPortType">
      <soap:binding style="document"
      transport="http://schemas.xmlsoap.org/soap/http" />
  
      <operation name="getAttraction">
        <soap:operation soapAction="getAttraction" />
  
        <input>
          <soap:body use="literal" />
        </input>
  
        <output>
          <soap:body use="literal" />
        </output>
      </operation>
    </binding>
  
    <service name="City_BBB">
      <port binding="tns:City_BBBBinding" name="City_BBBPort">
          <soap:address location="http://localhost:8080/axis/services/City_BBBPort"/>
      </port>
    </service>
  </definitions>
  
  
  
  
  1.1                  xml-axis/java/test/wsdl/wrapped/CityBBBBindingImpl.java
  
  Index: CityBBBBindingImpl.java
  ===================================================================
  /**
   * CityBBBBindingImpl.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis Wsdl2java emitter.
   */
  
  package test.wsdl.wrapped;
  
  public class CityBBBBindingImpl implements CityBBBBinding {
      public GetAttractionResponse getAttraction(GetAttraction getAttraction) throws java.rmi.RemoteException
{
          GetAttractionResponse response = new GetAttractionResponse();
          Attraction attraction = new Attraction();
          attraction.setOID("Attraction@cityCF::1028:1028");
          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 " +
                              " want to share a rousing celebration with. New Orleans is a
natural place for Christmas " +
                              " merry making, and if it is not, then, to quote a New Orleans
R&amp;B classic, " +
                              " &apos;grits ain&apos;t groceries, eggs ain&apos;t
poultry, and Mona Lisa was a " +
                              " man.&apos; Indeed, Christmas is an especially great time
to come because New Orleans " +
                              " hotels have attractive Papa  Noel rates. Throughout the month
of December, New Orleans " +
                              " will be decorated like never before, which is saying a lot
for a town that loves " +
                              " exhibitionism. From the quaint, light-entwined cast iron lamp
posts to the historic " +
                              " houses and museums bright in their period holiday garb, the
French Quarter will sparkle "+
                              " like an antique toy store. The twinkling lights and the cheery
voices of carolers will " +
                              " have you dancing and prancing through Jackson Square, in the
jingle bell air. Riverwalk "+
                              " shopping center is a leader in the celebrations, launching
brass band parades twice " +
                              " daily that include the grand ol&apos; rogue, Papa Noel,
and putting on a light show " +
                              " every evening in Spanish Plaza. Woldenberg Park, on the riverfront,
will decorate the " +
                              " night with commissioned light sculptures by local artists.
First National Bank of " +
                              " Commerce is sponsoring free nightly concerts of soul-stirring
gospel music in the " +
                              " stately St. Louis Cathedral. And New Orleans restaurants have
revived the tradition of "+
                              " &apos;Reveillon&apos; dinners, a name that comes from
the French word for " +
                              " &apos;awakening&apos; because it was a meal that was
eaten in the early morning " +
                              " immediately after Christmas Midnight Mass, in celebration
of the good news, of course, " +
                              " but, just as happily, in celebration of the end of the Advent
fast. You, however, do " +
                              " not have to wait til midnight, nor do you have to observe
the Advent fast. All you have"+
                              " to do is walk into a New Orleans restaurant and order food
so sublime, it is in itself" +
                              " 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;
      }
  }
  
  
  
  1.1                  xml-axis/java/test/wsdl/wrapped/CityBBBTestCase.java
  
  Index: CityBBBTestCase.java
  ===================================================================
  /**
   * CityBBBTestCase.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis Wsdl2java emitter.
   */
  
  package test.wsdl.wrapped;
  
  public class CityBBBTestCase extends junit.framework.TestCase {
      public CityBBBTestCase(String name) {
          super(name);
      }
      public void test1CityBBBPortGetAttraction() {
          CityBBBBinding binding;
          try {
              binding = new CityBBBLocator().getCityBBBPort();
          }
          catch (javax.xml.rpc.ServiceException jre) {
              throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught:
" + jre);
          }
          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());
          }
          catch (java.rmi.RemoteException re) {
              throw new junit.framework.AssertionFailedError("Remote Exception caught: " +
re);
          }
      }
  }
  
  
  
  

Mime
View raw message