You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/06/13 04:19:52 UTC
cvs commit: ws-axis/java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java SymbolTable.java TypeEntry.java
dims 2005/06/12 19:19:52
Modified: java/test/wsdl/arrays ArrayTest.wsdl
PersonalInfoBookSOAPBindingImpl.java
java/src/org/apache/axis/wsdl/toJava JavaBeanWriter.java
JavaStubWriter.java Utils.java
java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
SymbolTable.java TypeEntry.java
Added: java/test/wsdl/arrays4 ArrayTest.wsdl
ArrayTest4SOAPBindingImpl.java build.xml
StructureTypeTestCase.java
Removed: java/test/wsdl/arrays StructureTypeTestCase.java
Log:
Fix for AXIS-2026 - wsdl2java does not generate array of wrappers for soapenc array nillable elements
Revision Changes Path
1.6 +153 -258 ws-axis/java/test/wsdl/arrays/ArrayTest.wsdl
Index: ArrayTest.wsdl
===================================================================
RCS file: /home/cvs/ws-axis/java/test/wsdl/arrays/ArrayTest.wsdl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ArrayTest.wsdl 31 May 2005 19:58:25 -0000 1.5
+++ ArrayTest.wsdl 13 Jun 2005 02:19:52 -0000 1.6
@@ -1,258 +1,153 @@
-<?xml version="1.0" ?>
-
-<definitions name="urn:ArrayTest"
- targetNamespace="urn:ArrayTest2"
- xmlns:tns="urn:ArrayTest2"
- xmlns:typens="urn:ArrayTest2"
- xmlns:xsd="http://www.w3.org/1999/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soapy="http://xml.apache.org/xml-soap"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <!-- type defs -->
- <types>
- <xsd:schema targetNamespace="urn:ArrayTest2"
- xmlns:xsd="http://www.w3.org/1999/XMLSchema">
-
- <xsd:complexType name="hobbyArray">
- <xsd:complexContent>
- <xsd:restriction base="soapenc:Array">
- <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="petArray">
- <xsd:complexContent>
- <xsd:restriction base="soapenc:Array">
- <xsd:sequence>
- <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="intArray">
- <xsd:complexContent>
- <xsd:restriction base="soapenc:Array">
- <xsd:sequence>
- <xsd:element name="alias" type="xsd:int" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="personalInfo">
- <xsd:sequence>
- <xsd:element name="name" type="xsd:string"/>
- <!-- Style 1: Array defined using soapenc:Array -->
- <xsd:element name="favoriteMovies" type="soapenc:Array"/>
- <!-- Style 2: Array defined using derivation and wsdl:ArrayType -->
- <xsd:element name="hobbies" type="typens:hobbyArray"/>
- <!-- Style 3: Array defined using derivation of soapenc:Array -->
- <xsd:element name="id" type="typens:intArray"/>
- <xsd:element name="id2" type="xsd:int"/>
-
- <xsd:element name="pets" type="soapy:Vector"/>
-
- <!-- Collection defined using sequence of single unbounded element -->
- <xsd:element name="foods" type="xsd:string" maxOccurs="unbounded"/>
- <!-- Array of Bytes (nillable=true causes byte[] to become Byte[])-->
- <xsd:element name="nickName" type="xsd:hexBinary" nillable="true" />
-
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="StructureType">
- <xsd:all>
- <xsd:element name="fld1" type="xsd:int" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="fld2" type="tns:intarr" minOccurs="0"/>
- </xsd:all>
- </xsd:complexType>
-
- <xsd:complexType name="intarr">
- <xsd:complexContent>
- <xsd:restriction base="soapenc:Array">
- <xsd:sequence>
- <xsd:element name="element" type="xsd:int" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
-
-
- </xsd:schema>
-
- </types>
-
- <!-- message declns -->
- <message name="AddEntryRequest">
- <part name="name" type="xsd:string"/>
- <part name="info" type="typens:personalInfo"/>
- </message>
-
- <message name="GetPersonalInfoFromNameRequest">
- <part name="name" type="xsd:string"/>
- </message>
-
- <message name="GetPersonalInfoFromNameResponse">
- <part name="info" type="typens:personalInfo"/>
- </message>
-
- <message name="GetPetsFromNameRequest">
- <part name="name" type="xsd:string"/>
- </message>
-
- <message name="GetPetsFromNameResponse">
- <part name="pets" type="soapy:Vector"/>
- </message>
-
- <message name="GetIDFromNameRequest">
- <part name="name" type="xsd:string"/>
- </message>
-
- <message name="GetIDFromNameResponse">
- <part name="id" type="typens:intArray"/>
- </message>
-
- <message name="GetID2FromNameRequest">
- <part name="name" type="xsd:string"/>
- </message>
-
- <message name="GetID2FromNameResponse">
- <part name="id" type="xsd:int"/>
- </message>
-
- <message name="empty"/>
-
- <message name="EchoStructRequest">
- <part name="name" type="tns:StructureType"/>
- </message>
-
- <message name="EchoStructResponse">
- <part name="id" type="tns:StructureType"/>
- </message>
-
- <!-- port type declns -->
- <portType name="PersonalInfoBook">
- <operation name="addEntry">
- <input message="tns:AddEntryRequest"/>
- <output message="tns:empty"/>
- </operation>
- <operation name="getPersonalInfoFromName">
- <input message="tns:GetPersonalInfoFromNameRequest"/>
- <output message="tns:GetPersonalInfoFromNameResponse"/>
- </operation>
- <operation name="getPetsFromName">
- <input message="tns:GetPetsFromNameRequest"/>
- <output message="tns:GetPetsFromNameResponse"/>
- </operation>
- <operation name="getIDFromName">
- <input message="tns:GetIDFromNameRequest"/>
- <output message="tns:GetIDFromNameResponse"/>
- </operation>
- <operation name="getID2FromName">
- <input message="tns:GetID2FromNameRequest"/>
- <output message="tns:GetID2FromNameResponse"/>
- </operation>
- <operation name="echoStruct">
- <input message="tns:EchoStructRequest"/>
- <output message="tns:EchoStructResponse"/>
- </operation>
- </portType>
-
- <!-- binding declns -->
- <binding name="PersonalInfoBookSOAPBinding" type="tns:PersonalInfoBook">
- <soap:binding style="rpc"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="addEntry">
- <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="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"
- 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="getIDFromName">
- <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="getID2FromName">
- <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="echoStruct">
- <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>
- </binding>
-
- <!-- service decln -->
- <service name="PersonalInfoBookService">
- <port name="PersonalInfoBook" binding="tns:PersonalInfoBookSOAPBinding">
- <soap:address location="http://localhost:8080/axis/services/PersonalInfoBook"/>
- </port>
- </service>
-
-</definitions>
-
+<?xml version="1.0"?>
+<wsdl:definitions xmlns:tns="urn:ArrayTest2" xmlns:typens="urn:ArrayTest2" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapy="http://xml.apache.org/xml-soap" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:ArrayTest2" name="urn:ArrayTest">
+ <wsdl:types>
+ <xsd:schema targetNamespace="urn:ArrayTest2" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
+ <xsd:complexType name="hobbyArray">
+ <xsd:complexContent>
+ <xsd:restriction base="soapenc:Array">
+ <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:complexType name="petArray">
+ <xsd:complexContent>
+ <xsd:restriction base="soapenc:Array">
+ <xsd:sequence>
+ <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:complexType name="intArray">
+ <xsd:complexContent>
+ <xsd:restriction base="soapenc:Array">
+ <xsd:sequence>
+ <xsd:element name="alias" type="xsd:int" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:complexType name="personalInfo">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <!-- Style 1: Array defined using soapenc:Array -->
+ <xsd:element name="favoriteMovies" type="soapenc:Array"/>
+ <!-- Style 2: Array defined using derivation and wsdl:ArrayType -->
+ <xsd:element name="hobbies" type="typens:hobbyArray"/>
+ <!-- Style 3: Array defined using derivation of soapenc:Array -->
+ <xsd:element name="id" type="typens:intArray"/>
+ <xsd:element name="id2" type="xsd:int"/>
+ <xsd:element name="pets" type="soapy:Vector"/>
+ <!-- Collection defined using sequence of single unbounded element -->
+ <xsd:element name="foods" type="xsd:string" maxOccurs="unbounded"/>
+ <!-- Array of Bytes (nillable=true causes byte[] to become Byte[])-->
+ <xsd:element name="nickName" type="xsd:hexBinary" nillable="true"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <message name="AddEntryRequest">
+ <part name="name" type="xsd:string"/>
+ <part name="info" type="typens:personalInfo"/>
+ </message>
+ <message name="GetPersonalInfoFromNameRequest">
+ <part name="name" type="xsd:string"/>
+ </message>
+ <message name="GetPersonalInfoFromNameResponse">
+ <part name="info" type="typens:personalInfo"/>
+ </message>
+ <message name="GetPetsFromNameRequest">
+ <part name="name" type="xsd:string"/>
+ </message>
+ <message name="GetPetsFromNameResponse">
+ <part name="pets" type="soapy:Vector"/>
+ </message>
+ <message name="GetIDFromNameRequest">
+ <part name="name" type="xsd:string"/>
+ </message>
+ <message name="GetIDFromNameResponse">
+ <part name="id" type="typens:intArray"/>
+ </message>
+ <message name="GetID2FromNameRequest">
+ <part name="name" type="xsd:string"/>
+ </message>
+ <message name="GetID2FromNameResponse">
+ <part name="id" type="xsd:int"/>
+ </message>
+ <message name="empty"/>
+ <portType name="PersonalInfoBook">
+ <operation name="addEntry">
+ <input message="tns:AddEntryRequest"/>
+ <output message="tns:empty"/>
+ </operation>
+ <operation name="getPersonalInfoFromName">
+ <input message="tns:GetPersonalInfoFromNameRequest"/>
+ <output message="tns:GetPersonalInfoFromNameResponse"/>
+ </operation>
+ <operation name="getPetsFromName">
+ <input message="tns:GetPetsFromNameRequest"/>
+ <output message="tns:GetPetsFromNameResponse"/>
+ </operation>
+ <operation name="getIDFromName">
+ <input message="tns:GetIDFromNameRequest"/>
+ <output message="tns:GetIDFromNameResponse"/>
+ </operation>
+ <operation name="getID2FromName">
+ <input message="tns:GetID2FromNameRequest"/>
+ <output message="tns:GetID2FromNameResponse"/>
+ </operation>
+ </portType>
+ <binding name="PersonalInfoBookSOAPBinding" type="tns:PersonalInfoBook">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="addEntry">
+ <soap:operation/>
+ <input>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </input>
+ <output>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </output>
+ </operation>
+ <operation name="getPersonalInfoFromName">
+ <soap:operation/>
+ <input>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </input>
+ <output>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </output>
+ </operation>
+ <operation name="getPetsFromName">
+ <soap:operation/>
+ <input>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </input>
+ <output>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </output>
+ </operation>
+ <operation name="getIDFromName">
+ <soap:operation/>
+ <input>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </input>
+ <output>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </output>
+ </operation>
+ <operation name="getID2FromName">
+ <soap:operation/>
+ <input>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </input>
+ <output>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="PersonalInfoBookService">
+ <port name="PersonalInfoBook" binding="tns:PersonalInfoBookSOAPBinding">
+ <soap:address location="http://localhost:8080/axis/services/PersonalInfoBook"/>
+ </port>
+ </service>
+</wsdl:definitions>
1.4 +0 -4 ws-axis/java/test/wsdl/arrays/PersonalInfoBookSOAPBindingImpl.java
Index: PersonalInfoBookSOAPBindingImpl.java
===================================================================
RCS file: /home/cvs/ws-axis/java/test/wsdl/arrays/PersonalInfoBookSOAPBindingImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PersonalInfoBookSOAPBindingImpl.java 31 May 2005 19:58:25 -0000 1.3
+++ PersonalInfoBookSOAPBindingImpl.java 13 Jun 2005 02:19:52 -0000 1.4
@@ -26,8 +26,4 @@
public int getID2FromName(java.lang.String name) throws java.rmi.RemoteException {
return ((test.wsdl.arrays.PersonalInfo) table.get(name)).getId2();
}
-
- public StructureType echoStruct(StructureType in) throws java.rmi.RemoteException {
- return in;
- }
}
1.1 ws-axis/java/test/wsdl/arrays4/ArrayTest.wsdl
Index: ArrayTest.wsdl
===================================================================
<?xml version="1.0"?>
<wsdl:definitions xmlns:tns="urn:ArrayTest4" xmlns:typens="urn:ArrayTest4" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapy="http://xml.apache.org/xml-soap" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:ArrayTest4" name="urn:ArrayTest">
<wsdl:types>
<xsd:schema targetNamespace="urn:ArrayTest4" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="intArray">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:sequence>
<xsd:element name="alias" type="xsd:int" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="StructureType">
<xsd:sequence>
<xsd:element name="fld1" type="xsd:int" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="fld2" type="tns:intarr" minOccurs="0"/>
<xsd:element name="fld3" type="tns:intarr2" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="intarr">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:sequence>
<xsd:element name="element" type="xsd:int" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="intarr2">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:sequence>
<xsd:element name="element2" type="typens:intarr" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<message name="EchoStructRequest">
<part name="name" type="tns:StructureType"/>
</message>
<message name="EchoStructResponse">
<part name="id" type="tns:StructureType"/>
</message>
<portType name="ArrayTest4">
<operation name="echoStruct">
<input message="tns:EchoStructRequest"/>
<output message="tns:EchoStructResponse"/>
</operation>
</portType>
<binding name="ArrayTest4SOAPBinding" type="tns:ArrayTest4">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="echoStruct">
<soap:operation/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ArrayTest"/>
</output>
</operation>
</binding>
<service name="ArrayTest4Service">
<port name="ArrayTest4" binding="tns:ArrayTest4SOAPBinding">
<soap:address location="http://localhost:8080/axis/services/ArrayTest4"/>
</port>
</service>
</wsdl:definitions>
1.1 ws-axis/java/test/wsdl/arrays4/ArrayTest4SOAPBindingImpl.java
Index: ArrayTest4SOAPBindingImpl.java
===================================================================
/**
* ArrayTest4SOAPBindingImpl.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 12, 2005 (04:49:43 EDT) WSDL2Java emitter.
*/
package test.wsdl.arrays4;
public class ArrayTest4SOAPBindingImpl implements test.wsdl.arrays4.ArrayTest4{
public test.wsdl.arrays4.StructureType echoStruct(test.wsdl.arrays4.StructureType s) throws java.rmi.RemoteException {
return s;
}
}
1.1 ws-axis/java/test/wsdl/arrays4/build.xml
Index: build.xml
===================================================================
<?xml version="1.0" ?>
<!DOCTYPE project [
<!ENTITY properties SYSTEM "file:../../../xmls/properties.xml">
<!ENTITY paths SYSTEM "file:../../../xmls/path_refs.xml">
<!ENTITY taskdefs SYSTEM "file:../../../xmls/taskdefs.xml">
<!ENTITY taskdefs_post_compile SYSTEM "file:../../../xmls/taskdefs_post_compile.xml">
<!ENTITY targets SYSTEM "file:../../../xmls/targets.xml">
]>
<!-- ===================================================================
<description>
Test/Sample Component file for Axis
Notes:
This is a build file for use with the Jakarta Ant build tool.
Prerequisites:
jakarta-ant from http://jakarta.apache.org
Build Instructions:
To compile
ant compile
To execute
ant run
Author:
Matt Seibert mseibert@us.ibm.com
Copyright:
Copyright (c) 2002-2003 Apache Software Foundation.
</description>
==================================================================== -->
<project default="compile">
<property name="axis.home" location="../../.." />
<property name="componentName" value="test/wsdl/arrays4" />
&properties;
&paths;
&taskdefs;
&taskdefs_post_compile;
&targets;
<target name="clean">
<echo message="Removing ${build.dir}/classes/${componentName} and ${build.dir}/work/${componentName}" />
<delete dir="${build.dir}/classes/${componentName}"/>
<delete dir="${build.dir}/work/${componentName}"/>
</target>
<target name="copy" depends="setenv"/>
<target name="compile" depends="copy">
<echo message="Compiling test.wsdl.arrays4"/>
<!-- ArrayTest Test -->
<wsdl2java url="${axis.home}/test/wsdl/arrays4/ArrayTest.wsdl"
output="${axis.home}/build/work"
deployscope="session"
serverSide="yes"
skeletonDeploy="yes"
noimports="no"
verbose="no"
testcase="no">
<mapping namespace="urn:ArrayTest4" package="test.wsdl.arrays4"/>
</wsdl2java>
<copy todir="${build.dir}/work/test/wsdl/arrays4" overwrite="yes">
<fileset dir="${axis.home}/test/wsdl/arrays4">
<include name="*TestCase.java"/>
<include name="*Impl.java"/>
</fileset>
</copy>
<javac srcdir="${build.dir}/work" destdir="${build.dest}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}"
debug="${debug}">
<classpath refid="classpath" />
<include name="test/wsdl/arrays4/*.java" />
</javac>
</target>
<target name="run" >
<antcall target="execute-Component" />
</target>
</project>
1.1 ws-axis/java/test/wsdl/arrays4/StructureTypeTestCase.java
Index: StructureTypeTestCase.java
===================================================================
package test.wsdl.arrays4;
/**
* StructureTypeTestCase
* <p/>
* This test only needs to compile, as we are testing to make sure that the
* Schema in the WSDL generates the correctly wrapped Integer arrays.
*/
public class StructureTypeTestCase extends junit.framework.TestCase {
public StructureTypeTestCase(String name) {
super(name);
}
public void testEchoStruct() throws Exception {
ArrayTest4SOAPBindingStub binding;
try {
binding = (ArrayTest4SOAPBindingStub)
new ArrayTest4ServiceLocator().getArrayTest4();
} catch (javax.xml.rpc.ServiceException jre) {
if (jre.getLinkedCause() != null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertNotNull("binding is null", binding);
// Time out after a minute
binding.setTimeout(60000);
binding._setProperty("sendMultiRefs",Boolean.FALSE);
// Test operation
Integer a1[] = new Integer[]{new Integer(1), new Integer(2), new Integer(3)};
Integer a2[] = new Integer[] {new Integer(9), new Integer(8), new Integer(7)};
Integer a3[][] = new Integer[][] {
{new Integer(1), new Integer(2), new Integer(3)},
{new Integer(9), new Integer(8), new Integer(7)} };
final StructureType inStruct = new StructureType(a1, a2, a3);
StructureType value = null;
value = binding.echoStruct(inStruct);
Integer r1[] = value.getFld1();
assertEquals("return struct #1 didn't match", 1, r1[0].intValue() );
assertEquals("return struct #1 didn't match", 2, r1[1].intValue() );
assertEquals("return struct #1 didn't match", 3, r1[2].intValue() );
Integer r2[] = value.getFld2();
assertEquals("return struct #2 didn't match", 9, r2[0].intValue() );
assertEquals("return struct #2 didn't match", 8, r2[1].intValue() );
assertEquals("return struct #2 didn't match", 7, r2[2].intValue() );
Integer r3[][] = value.getFld3();
assertEquals("return struct #3 didn't match", 1, r3[0][0].intValue() );
assertEquals("return struct #3 didn't match", 2, r3[0][1].intValue() );
assertEquals("return struct #3 didn't match", 3, r3[0][2].intValue() );
assertEquals("return struct #3 didn't match", 9, r3[1][0].intValue() );
assertEquals("return struct #3 didn't match", 8, r3[1][1].intValue() );
assertEquals("return struct #3 didn't match", 7, r3[1][2].intValue() );
}
}
1.77 +12 -29 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java
Index: JavaBeanWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- JavaBeanWriter.java 30 May 2005 12:35:17 -0000 1.76
+++ JavaBeanWriter.java 13 Jun 2005 02:19:52 -0000 1.77
@@ -270,7 +270,17 @@
isAny = true;
} else {
variableName = elem.getName();
-
+ if (elem.getType().getUnderlTypeNillable()
+ || (elem.getNillable() && elem.getMaxOccursIsUnbounded())) {
+ /*
+ * Soapenc arrays with nillable underlying type or
+ * nillable="true" maxOccurs="unbounded" elements
+ * should be mapped to a wrapper type.
+ */
+ typeName = Utils.getWrapperType(elem.getType());
+
+ } else if (elem.getMinOccursIs0() && elem.getMaxOccursIsExactlyOne()
+ || elem.getNillable() || elem.getOptional()) {
/*
* Quote from JAX-RPC 1.1, Section 4.2.1:
* There are a number of cases in which a built-in simple
@@ -285,35 +295,8 @@
* to optional or absent and carrying neither
* the default nor the fixed attribute;
*/
- if (elem.getMinOccursIs0() && elem.getMaxOccursIsExactlyOne()
- || elem.getNillable() || elem.getOptional()) {
- String dims = null;
- /*
- * Handle situations where the nillable property is
- * combined with a non-singular 'maxOccurs' value
- * and the component type is a primitive, e.g.
- * <xsd:element name="code" type="xsd:int" nillable="true" maxOccurs="unbounded"/>
- * Under these circumstances we still have to promote
- * the underlying type to the corresponding wrapper
- * class.
- */
- if (elem.getType() instanceof CollectionTE) {
- TypeEntry te = elem.getType().getRefType();
- if (te instanceof BaseType
- || te instanceof DefinedElement
- && te.getRefType() instanceof BaseType) {
- /*
- * Deliberately looking at the dimensions introduced
- * by the 'maxOccurs' only, further dimensions
- * (if any) must be disregarded.
- */
- dims = elem.getType().getDimensions();
- typeName = te.getName();
- }
- }
typeName = Utils.getWrapperType(typeName);
- if (dims != null) typeName += dims;
- }
+ }
}
// Make sure the property name is not reserved.
1.151 +7 -2 ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
Index: JavaStubWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -r1.150 -r1.151
--- JavaStubWriter.java 2 May 2005 11:39:36 -0000 1.150
+++ JavaStubWriter.java 13 Jun 2005 02:19:52 -0000 1.151
@@ -1315,9 +1315,14 @@
TypeEntry type = param.getType();
if ((type != null) && (type.getName() != null)) {
+
String typeName = type.getName();
- if (param.isOmittable()) {
- typeName = Utils.getWrapperType(type.getName());
+ // If minOccurs="0" and singular or array with nillable underlying
+ // type get the corresponding wrapper type.
+ if ((param.isOmittable() && param.getType().getDimensions().equals(""))
+ || param.getType().getUnderlTypeNillable()) {
+
+ typeName = Utils.getWrapperType(type);
}
// Try casting the output to the expected output.
1.96 +40 -6 ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- Utils.java 20 May 2005 12:55:49 -0000 1.95
+++ Utils.java 13 Jun 2005 02:19:52 -0000 1.96
@@ -718,8 +718,12 @@
String objType = (String) TYPES.get(typeName);
if (objType != null) {
- if (param.isOmittable()) {
- typeName = objType;
+ // If minOccurs="0" and singular or array with nillable underlying
+ // type get the corresponding wrapper type.
+ if ((param.isOmittable() && param.getType().getDimensions().equals(""))
+ || param.getType().getUnderlTypeNillable()) {
+
+ typeName = getWrapperType(param.getType());
} else {
return "((" + objType + ") " + var + ")." + typeName +
"Value();";
@@ -754,6 +758,33 @@
}
/**
+ * Returns a "wrapper" type for the given TypeEntry.
+ *
+ * @param type
+ * @return the name of a java wrapper class for the type, or the type's
+ * name if it's not a primitive.
+ */
+ public static String getWrapperType(TypeEntry type) {
+ String dims = type.getDimensions();
+ if (!dims.equals("")) {
+
+ TypeEntry te = type.getRefType();
+ if (te != null
+ && !te.getDimensions().equals("")) {
+
+ return getWrapperType(te) + dims;
+ }
+ if (te instanceof BaseType
+ || te instanceof DefinedElement
+ && te.getRefType() instanceof BaseType) {
+
+ return getWrapperType(te) + dims;
+ }
+ }
+ return getWrapperType(type.getName());
+ }
+
+ /**
* Return the operation QName. The namespace is determined from
* the soap:body namespace, if it exists, otherwise it is "".
*
@@ -948,10 +979,13 @@
if (parm.getMIMEInfo() == null) {
ret = parm.getType().getName();
- if (parm.isOmittable()) {
- String wrapped = (String)TYPES.get(ret);
- if (wrapped != null)
- ret = wrapped;
+
+ // If minOccurs="0" and singular or array with nillable underlying
+ // type get the corresponding wrapper type.
+ if ((parm.isOmittable() && parm.getType().getDimensions().equals(""))
+ || parm.getType().getUnderlTypeNillable()) {
+
+ ret = getWrapperType(parm.getType());
}
} else {
String mime = parm.getMIMEInfo().getType();
1.59 +17 -3 ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
Index: SchemaUtils.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- SchemaUtils.java 30 May 2005 12:35:17 -0000 1.58
+++ SchemaUtils.java 13 Jun 2005 02:19:52 -0000 1.59
@@ -26,6 +26,7 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.holders.BooleanHolder;
import javax.xml.rpc.holders.IntHolder;
+import javax.xml.rpc.holders.BooleanHolder;
import javax.xml.rpc.holders.QNameHolder;
import java.util.Arrays;
import java.util.HashSet;
@@ -1295,15 +1296,17 @@
*/
public static QName getArrayComponentQName(Node node,
IntHolder dims,
+ BooleanHolder underlTypeNillable,
QNameHolder itemQName,
SymbolTable symbolTable) {
dims.value = 1; // assume 1 dimension
+ underlTypeNillable.value = false; // assume underlying type is not nillable
QName qName = getCollectionComponentQName(node, itemQName);
if (qName == null) {
- qName = getArrayComponentQName_JAXRPC(node, dims, symbolTable);
+ qName = getArrayComponentQName_JAXRPC(node, dims, underlTypeNillable, symbolTable);
}
return qName;
@@ -1439,11 +1442,12 @@
*/
private static QName getArrayComponentQName_JAXRPC(Node node,
IntHolder dims,
+ BooleanHolder underlTypeNillable,
SymbolTable symbolTable)
{
dims.value = 0; // Assume 0
-
+ underlTypeNillable.value = false;
if (node == null) {
return null;
}
@@ -1634,6 +1638,16 @@
// The element node should have maxOccurs="unbounded" and
// a type
if (elementNode != null) {
+
+ String underlTypeNillableValue = Utils.getAttribute(elementNode,
+ "nillable");
+
+ if (underlTypeNillableValue != null
+ && underlTypeNillableValue.equals("true")) {
+
+ underlTypeNillable.value = true;
+ }
+
String maxOccursValue = Utils.getAttribute(elementNode,
"maxOccurs");
@@ -2083,4 +2097,4 @@
}
return null;
}
-}
\ No newline at end of file
+}
1.122 +3 -1 ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
Index: SymbolTable.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- SymbolTable.java 12 Jun 2005 14:54:44 -0000 1.121
+++ SymbolTable.java 13 Jun 2005 02:19:52 -0000 1.122
@@ -1183,6 +1183,7 @@
// Flow to here indicates no type= or ref= attribute.
// See if this is an array or simple type definition.
IntHolder numDims = new IntHolder();
+ BooleanHolder underlTypeNillable = new BooleanHolder();
// If we're supposed to unwrap arrays, supply someplace to put the "inner" QName
// so we can propagate it into the appropriate metadata container.
@@ -1193,6 +1194,7 @@
QName arrayEQName =
SchemaUtils.getArrayComponentQName(node,
numDims,
+ underlTypeNillable,
itemQName,
this);
@@ -1242,6 +1244,7 @@
defType = new DefinedType(qName, refType, node, dims);
// Save component type for ArraySerializer
defType.setComponentType(arrayEQName);
+ defType.setUnderlTypeNillable(underlTypeNillable.value);
if (itemQName != null)
defType.setItemQName(itemQName.value);
}
@@ -1356,7 +1359,6 @@
symbolTablePut(containedTE);
}
-
symbolTablePut(new CollectionType(qName, containedTE,
node, "[]"));
} else {
1.19 +26 -0 ws-axis/java/src/org/apache/axis/wsdl/symbolTable/TypeEntry.java
Index: TypeEntry.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/TypeEntry.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- TypeEntry.java 12 Apr 2005 22:18:16 -0000 1.18
+++ TypeEntry.java 13 Jun 2005 02:19:52 -0000 1.19
@@ -83,6 +83,9 @@
// the array dims (for example "[]").
+ protected boolean underlTypeNillable = false; // if this is an array, underlTypeNillable indicates
+ // whether the underlying type of the array is nillable.
+
protected QName componentType = null; // If this is an array, the component type
/** If this TypeEntry represents an array with elements inside a "wrapper"
@@ -382,6 +385,29 @@
} // getDimensions
/**
+ * Return whether the underlying type is nillable if this is an array type.
+ * @return true if it is an array and nillable
+ */
+ public boolean getUnderlTypeNillable() {
+ // refType could refer to array with underlying nillable
+ // type - set the underlTypeNillable to true if this is
+ // the case.
+ if (!underlTypeNillable
+ && !getDimensions().equals("")
+ && refType != null) {
+ underlTypeNillable = refType.getUnderlTypeNillable();
+ }
+ return underlTypeNillable;
+ }
+
+ /**
+ * Set the boolean indicating whether underlying type of array is nillable.
+ */
+ public void setUnderlTypeNillable(boolean underlTypeNillable) {
+ this.underlTypeNillable = underlTypeNillable;
+ }
+
+ /**
* Return the QName of the component if this is an array type
* @return QName of array elements or null
*/