You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by nt...@apache.org on 2007/03/22 02:16:45 UTC
svn commit: r521065 - in /webservices/axis2/trunk/java/modules/jaxws: ./
src/org/apache/axis2/jaxws/message/databinding/
test/org/apache/axis2/jaxws/framework/ test/org/apache/axis2/jaxws/rpclit/
test/org/apache/axis2/jaxws/rpclit/enumtype/ test/org/ap...
Author: nthaker
Date: Wed Mar 21 18:16:43 2007
New Revision: 521065
URL: http://svn.apache.org/viewvc?view=rev&rev=521065
Log:
Axis2-2351
Fix for including enums in JAXBContext.
Added:
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/rpclitenum.wsdl
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/services.xml
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/PortTypeImpl.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/PortType.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/Service.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/tests/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/tests/RPCLitEnumTests.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/maven.xml
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
Modified: webservices/axis2/trunk/java/modules/jaxws/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/maven.xml?view=diff&rev=521065&r1=521064&r2=521065
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws/maven.xml Wed Mar 21 18:16:43 2007
@@ -244,6 +244,14 @@
<classpath location="${compiled.classes.dir}"/>
<arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/SOAPActionTest.wsdl"/>
</java>
+
+ <ant:echo>Generating java from rpclitenum.wsdl</ant:echo>
+ <java classname="com.sun.tools.xjc.Driver" fork="true">
+ <jvmarg line="${maven.junit.jvmargs2}"/>
+ <classpath refid="maven.dependency.classpath"/>
+ <classpath location="${compiled.classes.dir}"/>
+ <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/rpclitenum.wsdl"/>
+ </java>
<!-- Compile the generated classes -->
<ant:echo>Compiling generated schema</ant:echo>
<javac destdir="${schema.generated.classes.dir}" srcdir="${schema.generated.src.dir}">
@@ -658,6 +666,20 @@
<ant:include name="org/apache/axis2/jaxws/server/**"/>
</ant:fileset>
</ant:copy>
+
+ <ant:copy toDir="target/test-classes/services/RPCLitEnumService/">
+ <ant:fileset dir="target/test-classes">
+ <ant:include name="org/apache/axis2/jaxws/rpclit/enumtype/**"/>
+ </ant:fileset>
+ <ant:fileset dir="test/org/apache/axis2/jaxws/rpclit/enumtype">
+ <ant:include name="META-INF/**"/>
+ </ant:fileset>
+ <ant:fileset dir="target/classes">
+ <ant:include name="org/apache/axis2/jaxws/server/**"/>
+ </ant:fileset>
+ </ant:copy>
+
+
</postGoal>
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java?view=diff&rev=521065&r1=521064&r2=521065
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java Wed Mar 21 18:16:43 2007
@@ -609,7 +609,7 @@
// Only classes that represent data and can be marshalled
// by JAXB should be added.
if(!clazz.isInterface()
- && ClassUtils.getDefaultPublicConstructor(clazz) != null
+ && (clazz.isEnum() || ClassUtils.getDefaultPublicConstructor(clazz) != null)
&& !ClassUtils.isJAXWSClass(clazz)
&& !java.lang.Exception.class.isAssignableFrom(clazz)){
if (log.isDebugEnabled()) {
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=521065&r1=521064&r2=521065
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Wed Mar 21 18:16:43 2007
@@ -61,6 +61,7 @@
import org.apache.axis2.jaxws.proxy.ProxyTests;
import org.apache.axis2.jaxws.proxy.RPCProxyTests;
import org.apache.axis2.jaxws.proxy.SOAP12ProxyTests;
+import org.apache.axis2.jaxws.rpclit.enumtype.tests.RPCLitEnumTests;
import org.apache.axis2.jaxws.sample.AddNumbersTests;
import org.apache.axis2.jaxws.sample.AddressBookTests;
import org.apache.axis2.jaxws.sample.BareTests;
@@ -172,7 +173,7 @@
suite.addTestSuite(DispatchXPayloadJAXB.class);
suite.addTestSuite(DispatchXMessageDataSource.class);
suite.addTestSuite(SchemaReaderTests.class);
-
+ suite.addTestSuite(RPCLitEnumTests.class);
suite.addTestSuite(BindingProviderTests.class);
// Start (and stop) the server only once for all the tests
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/rpclitenum.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/rpclitenum.wsdl?view=auto&rev=521065
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/rpclitenum.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/rpclitenum.wsdl Wed Mar 21 18:16:43 2007
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<wsdl:definitions targetNamespace="http://rpclit.test.org"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://rpclit.test.org"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:intf="http://schema.rpclit.test.org"
+ xmlns:impl="http://schema.rpclit.test.org"
+ xmlns:apachesoap="http://xml.apache.org/xml-soap"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://schema.rpclit.test.org"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <!-- <element name="elementString"> -->
+ <simpleType name="elementString">
+ <restriction base="xsd:string">
+ <enumeration value="A"/>
+ <enumeration value="B"/>
+ <enumeration value="C"/>
+ </restriction>
+ </simpleType>
+ <!-- </element> -->
+ </schema>
+ </types>
+
+ <wsdl:message name="echoStringRequest">
+ <wsdl:part name="pString" type="intf:elementString"/>
+ </wsdl:message>
+ <wsdl:message name="echoStringResponse">
+ <wsdl:part name="pString" type="intf:elementString"/>
+ </wsdl:message>
+
+ <wsdl:portType name="PortType">
+ <wsdl:operation name="echoString">
+ <wsdl:input name="echoStringRequest" message="tns:echoStringRequest"/>
+ <wsdl:output name="echoStringResponse" message="tns:echoStringResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="Binding" type="tns:PortType">
+ <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="echoString">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="echoStringRequest">
+ <wsdlsoap:body
+ namespace="http://rpclit.test.org"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="echoStringResponse">
+ <wsdlsoap:body
+ namespace="http://rpclit.test.org"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="RPCLitEnumService">
+ <wsdl:port name="Port" binding="tns:Binding">
+ <wsdlsoap:address location="http://localhost:8080/axis2/services/RPCLitEnumService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+
+</wsdl:definitions>
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/services.xml?view=auto&rev=521065
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/services.xml Wed Mar 21 18:16:43 2007
@@ -0,0 +1,8 @@
+<serviceGroup>
+ <service name="RPCLitEnumService">
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+ </messageReceivers>
+ <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.rpclit.enumtype.PortTypeImpl</parameter>
+ </service>
+</serviceGroup>
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/PortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/PortTypeImpl.java?view=auto&rev=521065
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/PortTypeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/PortTypeImpl.java Wed Mar 21 18:16:43 2007
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.rpclit.enumtype;
+
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+
+import org.apache.axis2.jaxws.rpclit.enumtype.sei.PortType;
+import org.test.rpclit.schema.ElementString;
+
+@WebService(endpointInterface="org.apache.axis2.jaxws.rpclit.enumtype.PortTypeImpl")
+public class PortTypeImpl implements PortType {
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.jaxws.rpclit.enumtype.sei.PortType#echoString(javax.xml.ws.Holder)
+ */
+ public void echoString(Holder<ElementString> pString) {
+ ElementString es = pString.value;
+ if(es == es.A){
+ System.out.println("Enum A");
+ }
+ System.out.println("resetting Enum to B");
+ es = es.B;
+ pString.value = es;
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/PortType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/PortType.java?view=auto&rev=521065
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/PortType.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/PortType.java Wed Mar 21 18:16:43 2007
@@ -0,0 +1,33 @@
+package org.apache.axis2.jaxws.rpclit.enumtype.sei;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebParam.Mode;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.ws.Holder;
+import org.test.rpclit.schema.ElementString;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ *
+ */
+@WebService(name = "PortType", targetNamespace = "http://rpclit.test.org")
+@SOAPBinding(style = Style.RPC)
+public interface PortType {
+
+
+ /**
+ *
+ * @param pString
+ */
+ @WebMethod
+ public void echoString(
+ @WebParam(name = "pString", mode = Mode.INOUT, partName = "pString")
+ Holder<ElementString> pString);
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/Service.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/Service.java?view=auto&rev=521065
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/Service.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/sei/Service.java Wed Mar 21 18:16:43 2007
@@ -0,0 +1,60 @@
+package org.apache.axis2.jaxws.rpclit.enumtype.sei;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ *
+ */
+@WebServiceClient(name = "RPCLitEnumService", targetNamespace = "http://rpclit.test.org", wsdlLocation = "soapenc.wsdl")
+public class Service
+ extends javax.xml.ws.Service
+{
+
+ private final static URL SERVICE_WSDL_LOCATION;
+
+ private static String wsdlLocation="/test/org/apache/axis2/jaxws/rpclit/enumtype/META-INF/rpclitenum.wsdl";
+ static {
+ URL url = null;
+ try {
+ try{
+ String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+ wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ File file = new File(wsdlLocation);
+ url = file.toURL();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ SERVICE_WSDL_LOCATION = url;
+ }
+
+ public Service(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public Service() {
+ super(SERVICE_WSDL_LOCATION, new QName("http://rpclit.test.org", "RPCLitEnumService"));
+ }
+
+ /**
+ *
+ * @return
+ * returns PortType
+ */
+ @WebEndpoint(name = "Port")
+ public PortType getPort() {
+ return (PortType)super.getPort(new QName("http://rpclit.test.org", "Port"), PortType.class);
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/tests/RPCLitEnumTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/tests/RPCLitEnumTests.java?view=auto&rev=521065
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/tests/RPCLitEnumTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/rpclit/enumtype/tests/RPCLitEnumTests.java Wed Mar 21 18:16:43 2007
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.rpclit.enumtype.tests;
+
+
+
+import javax.xml.ws.Holder;
+
+import org.apache.axis2.jaxws.rpclit.enumtype.sei.PortType;
+import org.apache.axis2.jaxws.rpclit.enumtype.sei.Service;
+import org.test.rpclit.schema.ElementString;
+
+import junit.framework.TestCase;
+
+
+public class RPCLitEnumTests extends TestCase {
+ public void testEnumSimpleType(){
+ System.out.println("------------------------------");
+ System.out.println("Test : "+getName());
+ try{
+ Service service = new Service();
+ PortType portType = service.getPort();
+ Holder<ElementString> pString = new Holder<ElementString>(ElementString.A);
+ portType.echoString(pString);
+ ElementString es = pString.value;
+ System.out.println("Response =" + es);
+ System.out.print("---------------------------------");
+ }catch(Exception e){
+ e.printStackTrace();
+ fail();
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org