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/test/arrays ArrayTest.wsdl Main.java PersonalInfoBookSOAPBindingImpl.java
Date Tue, 04 Dec 2001 22:11:47 GMT
scheu       01/12/04 14:11:47

  Modified:    java/src/org/apache/axis/wsdl JavaStubWriter.java
               java/test/arrays ArrayTest.wsdl Main.java
                        PersonalInfoBookSOAPBindingImpl.java
  Log:
  An exception occurs in the Stub if an operation returns an array.
  The problem is that Axis actually returns a java.util.ArrayList object.
  
  As a quick fix for alpha 3, when a operation returns an array, the
  Stub will use the JavaUtils.convert method to convert the ArrayList object
  to the expected array object.
  
  Post-Alpha 3 we will need to determine where in the Axis runtime to do
  this conversion.
  
  I also changed the test/arrays test to verify this processing (added an
  operation that returns String[]).
  
  This problem was encountered by Rick Rineholt.
  
  Revision  Changes    Path
  1.20      +26 -3     xml-axis/java/src/org/apache/axis/wsdl/JavaStubWriter.java
  
  Index: JavaStubWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaStubWriter.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- JavaStubWriter.java	2001/12/04 19:34:56	1.19
  +++ JavaStubWriter.java	2001/12/04 22:11:47	1.20
  @@ -448,7 +448,18 @@
                   else {
                       // (parms.outputs == 1)
                       // There is only one output and it is the return value.
  -                    pw.println("             return " + getResponseString(parms.returnType,
"resp"));
  +                    
  +                    // Quick Fix By scheu for now.  This should be fixed elsewhere. 
  +                    if (parms.returnType != null &&
  +                        parms.returnType.getJavaName() != null &&
  +                        parms.returnType.getJavaName().indexOf("[]") > 0) {
  +                        pw.println("             // REVISIT THIS!");
  +                        pw.println("             return ("+parms.returnType.getJavaName()
+ ")" 
  +                                   +"org.apache.axis.utils.JavaUtils.convert(resp,"
  +                                   + parms.returnType.getJavaName()+".class);");
  +                    } else {
  +                        pw.println("             return " + getResponseString(parms.returnType,
"resp"));
  +                    }
                   }
               }
               else {
  @@ -471,9 +482,21 @@
                           }
                       }
   
  +                }
  +                if (parms.outputs > 0) {
  +                    // Quick Fix By scheu for now.  This should be fixed elsewhere.
  +                    if (parms.returnType != null &&
  +                        parms.returnType.getJavaName() != null &&
  +                        parms.returnType.getJavaName().indexOf("[]") > 0) {
  +                        pw.println("             // REVISIT THIS!");
  +                        pw.println("             return ("+parms.returnType.getJavaName()
+ ")" 
  +                                   +"org.apache.axis.utils.JavaUtils.convert(resp,"
  +                                   + parms.returnType.getJavaName()+".class);");
  +                    } else {
  +                        pw.println("             return " + getResponseString(parms.returnType,
"resp"));
  +                    }
  +
                   }
  -                if (parms.outputs > 0)
  -                    pw.println ("            return " + getResponseString(parms.returnType,
"resp"));
   
               }
               pw.println("        }");
  
  
  
  1.6       +25 -0     xml-axis/java/test/arrays/ArrayTest.wsdl
  
  Index: ArrayTest.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/arrays/ArrayTest.wsdl,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ArrayTest.wsdl	2001/11/30 21:53:33	1.5
  +++ ArrayTest.wsdl	2001/12/04 22:11:47	1.6
  @@ -78,6 +78,14 @@
       <part name="info" type="typens:personalInfo"/>
     </message>
   
  +  <message name="GetPetsFromNameRequest">
  +    <part name="name" type="xsd:string"/>
  +  </message>
  +
  +  <message name="GetPetsFromNameResponse">
  +    <part name="pets" type="typens:petArray"/>
  +  </message>
  +
     <!-- port type declns -->
     <portType name="PersonalInfoBook">
       <operation name="addEntry">
  @@ -87,6 +95,10 @@
         <input message="tns:GetPersonalInfoFromNameRequest"/>
         <output message="tns:GetPersonalInfoFromNameResponse"/>
       </operation>
  +    <operation name="getPetsFromName">
  +      <input message="tns:GetPetsFromNameRequest"/>
  +      <output message="tns:GetPetsFromNameResponse"/>
  +    </operation>
     </portType>
   
     <!-- binding declns -->
  @@ -107,6 +119,19 @@
         </output>
       </operation>
       <operation name="getPersonalInfoFromName">
  +      <soap:operation soapAction=""/>
  +      <input>
  +        <soap:body use="encoded"
  +                   namespace="urn:ArrayTest"
  +                   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </input>
  +      <output>
  +        <soap:body use="encoded"
  +                   namespace="urn:ArrayTest"
  +                   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </output>
  +    </operation>
  +    <operation name="getPetsFromName">
         <soap:operation soapAction=""/>
         <input>
           <soap:body use="encoded"
  
  
  
  1.6       +3 -1      xml-axis/java/test/arrays/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/arrays/Main.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Main.java	2001/11/30 21:53:33	1.5
  +++ Main.java	2001/12/04 22:11:47	1.6
  @@ -99,7 +99,6 @@
               System.err.print(" \"" + (String) h[i] + "\"");
           System.err.println("");
   
  -        Object[] pets =pi.getPets();
           System.err.print ("\tPets=");
           for(int i=0; i<pets.length; i++)
               System.err.print(" \"" + (String) pets[i] + "\"");
  @@ -131,6 +130,9 @@
           pib.addEntry (name, pi);
           System.err.println (">> Querying info for '" + name + "'");
           PersonalInfo resp = pib.getPersonalInfoFromName (name);
  +
  +        // Get just the pets to test return of an array.
  +        pets = pib.getPetsFromName (name);
           System.err.println (">> Response is:");
           printPersonalInfo (resp);
           pib.addEntry (name, pi);
  
  
  
  1.2       +3 -0      xml-axis/java/test/arrays/PersonalInfoBookSOAPBindingImpl.java
  
  Index: PersonalInfoBookSOAPBindingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/arrays/PersonalInfoBookSOAPBindingImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PersonalInfoBookSOAPBindingImpl.java	2001/11/09 22:51:15	1.1
  +++ PersonalInfoBookSOAPBindingImpl.java	2001/12/04 22:11:47	1.2
  @@ -16,4 +16,7 @@
       public test.arrays.PersonalInfo getPersonalInfoFromName(java.lang.String name) throws
java.rmi.RemoteException {
           return (test.arrays.PersonalInfo) table.get(name);
       }
  +    public String[] getPetsFromName(java.lang.String name) throws java.rmi.RemoteException
{
  +        return ((test.arrays.PersonalInfo) table.get(name)).getPets();
  +    }
   }
  
  
  

Mime
View raw message