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 2003/10/27 15:18:09 UTC
cvs commit: ws-axis/java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java
dims 2003/10/27 06:18:09
Modified: java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java
Added: java/test/wsdl/wrapped2 build.xml employee.wsdl
EmployeeDatabaseTestCase.java
EmployeeDBBindingImpl.java
Log:
Fix and test case for Bug 24141 - Wrapped style skips necessary type generations
from iasandcb@apache-korea.org (Ias)
Revision Changes Path
1.1 ws-axis/java/test/wsdl/wrapped2/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/wrapped2" />
&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.wrapped2"/>
<!-- Employee Sample Test -->
<wsdl2java url="${axis.home}/test/wsdl/wrapped2/employee.wsdl"
output="${axis.home}/build/work"
deployscope="session"
serverSide="yes"
skeletonDeploy="yes"
testcase="yes">
<mapping namespace="http://www.sun.com/JSR172UseCases" package="test.wsdl.wrapped2"/>
<mapping namespace="http://www.sun.com/JSR172AppendixA.xsd" package="test.wsdl.wrapped2.xsd"/>
</wsdl2java>
<copy todir="${build.dir}/work/test/wsdl/wrapped2" overwrite="yes">
<fileset dir="${axis.home}/test/wsdl/wrapped2">
<include name="*TestCase.java"/>
<include name="*Impl.java"/>
</fileset>
</copy>
<javac srcdir="${build.dir}/work" destdir="${build.dest}" fork="${javac.fork}"
debug="${debug}">
<classpath refid="classpath" />
<include name="test/wsdl/wrapped2/*.java" />
</javac>
</target>
<target name="run" >
<antcall target="execute-Component" />
</target>
</project>
1.1 ws-axis/java/test/wsdl/wrapped2/employee.wsdl
Index: employee.wsdl
===================================================================
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sun.com/JSR172UseCases" xmlns:xsd1="http://www.sun.com/JSR172AppendixA.xsd" targetNamespace="http://www.sun.com/JSR172UseCases" name="JSR172AppendixA">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.sun.com/JSR172AppendixA.xsd" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://www.sun.com/JSR172AppendixA.xsd">
<xsd:complexType name="NameType">
<xsd:sequence>
<xsd:element name="firstName" type="xsd:string"/>
<xsd:element name="lastName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="NameArrayType">
<xsd:sequence>
<xsd:element name="Name" maxOccurs="unbounded" minOccurs="1" nillable="true" type="xsd1:NameType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="EmployeeType">
<xsd:sequence>
<xsd:element name="empName" type="xsd1:NameType"/>
<xsd:element name="empID" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="EmployeeArrayType">
<xsd:sequence>
<xsd:element name="Employee" maxOccurs="unbounded" minOccurs="1" nillable="true" type="xsd1:EmployeeType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="EmployeeArray" type="xsd1:EmployeeArrayType"/>
<xsd:element name="getEmployeeCount" type="xsd:int"/>
<xsd:element name="addGroups">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="group" maxOccurs="unbounded" minOccurs="1" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="isManager" type="xsd1:NameType"/>
<xsd:element name="promoteEmployee" type="xsd1:EmployeeType"/>
<xsd:element name="getEmployees" type="xsd1:NameArrayType"/>
<xsd:element name="scheduleMtg" type="xsd1:EmployeeArrayType"/>
<xsd:element name="EmpCount" type="xsd:int"/>
<xsd:element name="RetVal" type="xsd:boolean"/>
</xsd:schema>
</types>
<message name="getEmployeeCountReq">
<part name="EmpCountReq" element="xsd1:getEmployeeCount"/>
</message>
<message name="getEmployeeCountRes">
<part name="EmpCountRes" element="xsd1:EmpCount"/>
</message>
<message name="addGroupsReq">
<part name="AddGroupReq" element="xsd1:addGroups"/>
</message>
<message name="addGroupsRes">
<part name="AddGroupRes" element="xsd1:RetVal"/>
</message>
<message name="isManagerReq">
<part name="ManagerReq" element="xsd1:isManager"/>
</message>
<message name="isManagerRes">
<part name="ManagerRes" element="xsd1:RetVal"/>
</message>
<message name="promoteEmployeeReq">
<part name="promoteReq" element="xsd1:promoteEmployee"/>
</message>
<message name="promoteEmployeeRes">
<part name="promoteRes" element="xsd1:RetVal"/>
</message>
<message name="getEmployeesReq">
<part name="employeesReq" element="xsd1:getEmployees"/>
</message>
<message name="getEmployeesRes">
<part name="employeesRes" element="xsd1:EmployeeArray"/>
</message>
<message name="scheduleMtgReq">
<part name="scheduleReq" element="xsd1:scheduleMtg"/>
</message>
<message name="scheduleMtgRes">
<part name="scheduleRes" element="xsd1:RetVal"/>
</message>
<portType name="EmployeeDBPort">
<operation name="getEmployeeCount">
<input message="tns:getEmployeeCountReq"/>
<output message="tns:getEmployeeCountRes"/>
</operation>
<operation name="addGroups">
<input message="tns:addGroupsReq"/>
<output message="tns:addGroupsRes"/>
</operation>
<operation name="isManager">
<input message="tns:isManagerReq"/>
<output message="tns:isManagerRes"/>
</operation>
<operation name="promoteEmployee">
<input message="tns:promoteEmployeeReq"/>
<output message="tns:promoteEmployeeRes"/>
</operation>
<operation name="getEmployees">
<input message="tns:getEmployeesReq"/>
<output message="tns:getEmployeesRes"/>
</operation>
<operation name="scheduleMtg">
<input message="tns:scheduleMtgReq"/>
<output message="tns:scheduleMtgRes"/>
</operation>
</portType>
<binding name="EmployeeDBBinding" type="tns:EmployeeDBPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getEmployeeCount">
<soap:operation soapAction="http://www.sun.com/JSR172UseCases/getEmployeeCount"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="addGroups">
<soap:operation soapAction="http://www.sun.com/JSR172UseCases/addGroups"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="isManager">
<soap:operation soapAction="http://www.sun.com/JSR172UseCases/isManager"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="promoteEmployee">
<soap:operation soapAction="http://www.sun.com/JSR172UseCases/promoteEmployee"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="getEmployees">
<soap:operation soapAction="http://www.sun.com/JSR172UseCases/getEmployees"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="scheduleMtg">
<soap:operation soapAction="http://www.sun.com/JSR172UseCases/scheduleMtg"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="EmployeeDatabase">
<port name="EmployeeDatabase" binding="tns:EmployeeDBBinding">
<soap:address location="http://localhost:8080/axis/services/EmployeeDatabase"/>
</port>
</service>
</definitions>
1.1 ws-axis/java/test/wsdl/wrapped2/EmployeeDatabaseTestCase.java
Index: EmployeeDatabaseTestCase.java
===================================================================
/**
* EmployeeDatabaseTestCase.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2dev Oct 26, 2003 (08:57:14 EST) WSDL2Java emitter.
*/
package test.wsdl.wrapped2;
public class EmployeeDatabaseTestCase extends junit.framework.TestCase {
public EmployeeDatabaseTestCase(java.lang.String name) {
super(name);
}
public void test1EmployeeDatabaseGetEmployeeCount() throws Exception {
test.wsdl.wrapped2.EmployeeDBBindingStub binding;
try {
binding = (test.wsdl.wrapped2.EmployeeDBBindingStub)
new test.wsdl.wrapped2.EmployeeDatabaseLocator().getEmployeeDatabase();
}
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);
// Test operation
int value = -3;
value = binding.getEmployeeCount(0);
// TBD - validate results
}
public void test2EmployeeDatabaseAddGroups() throws Exception {
test.wsdl.wrapped2.EmployeeDBBindingStub binding;
try {
binding = (test.wsdl.wrapped2.EmployeeDBBindingStub)
new test.wsdl.wrapped2.EmployeeDatabaseLocator().getEmployeeDatabase();
}
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);
// Test operation
boolean value = false;
value = binding.addGroups(new java.lang.String[0]);
// TBD - validate results
}
public void test3EmployeeDatabaseIsManager() throws Exception {
test.wsdl.wrapped2.EmployeeDBBindingStub binding;
try {
binding = (test.wsdl.wrapped2.EmployeeDBBindingStub)
new test.wsdl.wrapped2.EmployeeDatabaseLocator().getEmployeeDatabase();
}
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);
// Test operation
boolean value = false;
value = binding.isManager(new java.lang.String(), new java.lang.String());
// TBD - validate results
}
public void test4EmployeeDatabasePromoteEmployee() throws Exception {
test.wsdl.wrapped2.EmployeeDBBindingStub binding;
try {
binding = (test.wsdl.wrapped2.EmployeeDBBindingStub)
new test.wsdl.wrapped2.EmployeeDatabaseLocator().getEmployeeDatabase();
}
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);
// Test operation
boolean value = false;
value = binding.promoteEmployee(new test.wsdl.wrapped2.xsd.NameType(), 0);
// TBD - validate results
}
public void test5EmployeeDatabaseGetEmployees() throws Exception {
test.wsdl.wrapped2.EmployeeDBBindingStub binding;
try {
binding = (test.wsdl.wrapped2.EmployeeDBBindingStub)
new test.wsdl.wrapped2.EmployeeDatabaseLocator().getEmployeeDatabase();
}
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);
// Test operation
test.wsdl.wrapped2.xsd.EmployeeType[] value = null;
value = binding.getEmployees(new test.wsdl.wrapped2.xsd.NameType[0]);
// TBD - validate results
}
public void test6EmployeeDatabaseScheduleMtg() throws Exception {
test.wsdl.wrapped2.EmployeeDBBindingStub binding;
try {
binding = (test.wsdl.wrapped2.EmployeeDBBindingStub)
new test.wsdl.wrapped2.EmployeeDatabaseLocator().getEmployeeDatabase();
}
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);
// Test operation
boolean value = false;
value = binding.scheduleMtg(new test.wsdl.wrapped2.xsd.EmployeeType[0]);
// TBD - validate results
}
}
1.1 ws-axis/java/test/wsdl/wrapped2/EmployeeDBBindingImpl.java
Index: EmployeeDBBindingImpl.java
===================================================================
/**
* EmployeeDBBindingImpl.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2dev Oct 26, 2003 (08:57:14 EST) WSDL2Java emitter.
*/
package test.wsdl.wrapped2;
public class EmployeeDBBindingImpl implements test.wsdl.wrapped2.EmployeeDBPort{
public int getEmployeeCount(int empCountReq) throws java.rmi.RemoteException {
return -3;
}
public boolean addGroups(java.lang.String[] group) throws java.rmi.RemoteException {
return false;
}
public boolean isManager(java.lang.String firstName, java.lang.String lastName) throws java.rmi.RemoteException {
return false;
}
public boolean promoteEmployee(test.wsdl.wrapped2.xsd.NameType empName, int empID) throws java.rmi.RemoteException {
return false;
}
public test.wsdl.wrapped2.xsd.EmployeeType[] getEmployees(test.wsdl.wrapped2.xsd.NameType[] name) throws java.rmi.RemoteException {
return null;
}
public boolean scheduleMtg(test.wsdl.wrapped2.xsd.EmployeeType[] employee) throws java.rmi.RemoteException {
return false;
}
}
1.78 +5 -0 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.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- SymbolTable.java 27 Oct 2003 01:52:50 -0000 1.77
+++ SymbolTable.java 27 Oct 2003 14:18:09 -0000 1.78
@@ -2485,6 +2485,11 @@
Iterator it = nestedTypes.iterator();
while (it.hasNext()) {
TypeEntry nestedType = (TypeEntry) it.next();
+ TypeEntry refType = entry.getRefType();
+ if (refType != null && !refType.equals(nestedType) && nestedType.isOnlyLiteralReferenced())
+ {
+ nestedType.setOnlyLiteralReference(false);
+ }
if (!nestedType.isReferenced()) {
//setTypeReferences(nestedType, doc, literal);
if(nestedType != entry)