dims 2003/03/05 05:59:07
Modified: java/src/org/apache/axis/wsdl/toJava
JavaBeanHelperWriter.java
Added: java/test/wsdl/extension build.xml extension.wsdl
PlanWSSoapImpl.java PlanWSTestCase.java
Log:
1. Fix for Bug 17484 - WSDL2JAVA generates wrong getSerializer / getDeserializer
Methods
2. Fix for Bug 17140 - XML Schema Extension Element not Deserialized Correctly
3. Added Test case as well.
Revision Changes Path
1.1 xml-axis/java/test/wsdl/extension/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 [EMAIL PROTECTED]
Copyright:
Copyright (c) 2002-2003 Apache Software Foundation.
</description>
==================================================================== -->
<project default="compile">
<property name="axis.home" location="../../.." />
<property name="componentName" value="test/wsdl/extension" />
&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.extension"/>
<!-- extension Sample Test -->
<wsdl2java url="${axis.home}/test/wsdl/extension/extension.wsdl"
output="${axis.home}/build/work"
deployscope="session"
serverSide="yes"
skeletonDeploy="yes"
testcase="yes">
<mapping namespace="http://tempuri.org/" package="test.wsdl.extension"/>
</wsdl2java>
<copy todir="${build.dir}/work/test/wsdl/extension" overwrite="yes">
<fileset dir="${axis.home}/test/wsdl/extension">
<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/extension/*.java" />
</javac>
</target>
<target name="run" >
<antcall target="execute-Component" />
</target>
</project>
1.1 xml-axis/java/test/wsdl/extension/extension.wsdl
Index: extension.wsdl
===================================================================
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://tempuri.org/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://tempuri.org/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/">
<s:element name="GetPlan">
<s:complexType />
</s:element>
<s:element name="GetPlanResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetPlanResult"
type="s0:Plan" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="Plan">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Disposition"
type="s0:Disposition" />
</s:sequence>
</s:complexType>
<s:complexType name="Disposition">
<s:complexContent mixed="false">
<s:extension base="s0:Status" />
</s:complexContent>
</s:complexType>
<s:complexType name="Status">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Code" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Description"
type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="Plan" nillable="true" type="s0:Plan" />
</s:schema>
</types>
<message name="GetPlanSoapIn">
<part name="parameters" element="s0:GetPlan" />
</message>
<message name="GetPlanSoapOut">
<part name="parameters" element="s0:GetPlanResponse" />
</message>
<message name="GetPlanHttpGetIn" />
<message name="GetPlanHttpGetOut">
<part name="Body" element="s0:Plan" />
</message>
<message name="GetPlanHttpPostIn" />
<message name="GetPlanHttpPostOut">
<part name="Body" element="s0:Plan" />
</message>
<portType name="PlanWSSoap">
<operation name="GetPlan">
<input message="s0:GetPlanSoapIn" />
<output message="s0:GetPlanSoapOut" />
</operation>
</portType>
<portType name="PlanWSHttpGet">
<operation name="GetPlan">
<input message="s0:GetPlanHttpGetIn" />
<output message="s0:GetPlanHttpGetOut" />
</operation>
</portType>
<portType name="PlanWSHttpPost">
<operation name="GetPlan">
<input message="s0:GetPlanHttpPostIn" />
<output message="s0:GetPlanHttpPostOut" />
</operation>
</portType>
<binding name="PlanWSSoap" type="s0:PlanWSSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="GetPlan">
<soap:operation soapAction="http://tempuri.org/GetPlan"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<binding name="PlanWSHttpGet" type="s0:PlanWSHttpGet">
<http:binding verb="GET" />
<operation name="GetPlan">
<http:operation location="/GetPlan" />
<input>
<http:urlEncoded />
</input>
<output>
<mime:mimeXml part="Body" />
</output>
</operation>
</binding>
<binding name="PlanWSHttpPost" type="s0:PlanWSHttpPost">
<http:binding verb="POST" />
<operation name="GetPlan">
<http:operation location="/GetPlan" />
<input>
<mime:content type="application/x-www-form-urlencoded" />
</input>
<output>
<mime:mimeXml part="Body" />
</output>
</operation>
</binding>
<service name="PlanWS">
<port name="PlanWSSoap" binding="s0:PlanWSSoap">
<soap:address location="http://localhost:8080/axis/services/PlanWSSoap" />
</port>
<port name="PlanWSHttpGet" binding="s0:PlanWSHttpGet">
<http:address location="http://localhost:8080/axis/services/PlanWSSoap" />
</port>
<port name="PlanWSHttpPost" binding="s0:PlanWSHttpPost">
<http:address location="http://localhost:8080/axis/services/PlanWSSoap" />
</port>
</service>
</definitions>
1.1 xml-axis/java/test/wsdl/extension/PlanWSSoapImpl.java
Index: PlanWSSoapImpl.java
===================================================================
/**
* PlanWSSoapImpl.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package test.wsdl.extension;
public class PlanWSSoapImpl implements test.wsdl.extension.PlanWSSoap{
public test.wsdl.extension.Plan getPlan() throws java.rmi.RemoteException {
test.wsdl.extension.Disposition disposition = new
test.wsdl.extension.Disposition();
disposition.setCode("CODE #1");
disposition.setDescription("CODE #1 Description");
test.wsdl.extension.Plan plan = new test.wsdl.extension.Plan();
plan.setDisposition(disposition);
return plan;
}
}
1.1 xml-axis/java/test/wsdl/extension/PlanWSTestCase.java
Index: PlanWSTestCase.java
===================================================================
/**
* PlanWSTestCase.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package test.wsdl.extension;
public class PlanWSTestCase extends junit.framework.TestCase {
public PlanWSTestCase(java.lang.String name) {
super(name);
}
public void test1PlanWSSoapGetPlan() throws Exception {
test.wsdl.extension.PlanWSSoapStub binding;
try {
binding = (test.wsdl.extension.PlanWSSoapStub)
new test.wsdl.extension.PlanWSLocator().getPlanWSSoap();
}
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.extension.Plan value = null;
value = binding.getPlan();
// TBD - validate results
assertEquals(value.getDisposition().getCode(),"CODE #1");
assertEquals(value.getDisposition().getDescription(),"CODE #1 Description");
}
}
1.36 +2 -8
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
Index: JavaBeanHelperWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- JavaBeanHelperWriter.java 1 Mar 2003 04:48:13 -0000 1.35
+++ JavaBeanHelperWriter.java 5 Mar 2003 13:59:07 -0000 1.36
@@ -343,10 +343,7 @@
* undo introspection.
*/
protected void writeSerializer(PrintWriter pw) throws IOException {
- String typeDesc = null;
- if (attributes != null || elementMetaData != null) {
- typeDesc = "typeDesc";
- }
+ String typeDesc = "typeDesc";
String ser = " org.apache.axis.encoding.ser.BeanSerializer";
if (type.isSimpleType()) {
ser = " org.apache.axis.encoding.ser.SimpleSerializer";
@@ -370,10 +367,7 @@
* undo introspection.
*/
protected void writeDeserializer(PrintWriter pw) throws IOException {
- String typeDesc = null;
- if (attributes != null || elementMetaData != null) {
- typeDesc = "typeDesc";
- }
+ String typeDesc = "typeDesc";
String dser = " org.apache.axis.encoding.ser.BeanDeserializer";
if (type.isSimpleType()) {
dser = " org.apache.axis.encoding.ser.SimpleDeserializer";