summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/interface-java-jaxws/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-07-30 17:13:07 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-07-30 17:13:07 +0000
commit8e4512b1d9e09e3b79ad534492acff2ab6f1e760 (patch)
tree6380a160799ae2813ce1caee059c2ca59da862cb /java/sca/modules/interface-java-jaxws/src
parent744d23fe6f4a293015272943f90b78a8825a5f16 (diff)
Fix for TUSCANY-2505
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@681126 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/interface-java-jaxws/src')
-rw-r--r--java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java12
-rw-r--r--java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java23
-rw-r--r--java/sca/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl14
3 files changed, 40 insertions, 9 deletions
diff --git a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
index 1e1a0c4e94..f779e04258 100644
--- a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
+++ b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
@@ -203,6 +203,11 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor {
QName qname = new QName(inputNS, inputName);
DataType dt = new DataTypeImpl<XMLType>(wrapperClass, new XMLType(qname, qname));
dataBindingExtensionPoint.introspectType(dt, operation);
+ // TUSCANY-2505
+ if (dt.getLogical() instanceof XMLType) {
+ XMLType xmlType = (XMLType)dt.getLogical();
+ xmlType.setElementName(qname);
+ }
return dt;
} catch (ClassNotFoundException e) {
GeneratedClassLoader cl = new GeneratedClassLoader(clazz.getClassLoader());
@@ -235,9 +240,14 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor {
try {
Class<?> wrapperClass =
Class.forName(outputWrapperClassName, false, clazz.getClassLoader());
- QName qname = new QName(inputNS, inputName);
+ QName qname = new QName(outputNS, outputName);
DataType dt = new DataTypeImpl<XMLType>(wrapperClass, new XMLType(qname, qname));
dataBindingExtensionPoint.introspectType(dt, operation);
+ // TUSCANY-2505
+ if (dt.getLogical() instanceof XMLType) {
+ XMLType xmlType = (XMLType)dt.getLogical();
+ xmlType.setElementName(qname);
+ }
return dt;
} catch (ClassNotFoundException e) {
GeneratedClassLoader cl = new GeneratedClassLoader(clazz.getClassLoader());
diff --git a/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
index 4eafc4e1ce..cdfac400e2 100644
--- a/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
+++ b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
@@ -22,13 +22,21 @@ package org.apache.tuscany.sca.interfacedef.java.jaxws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+import junit.framework.Assert;
import junit.framework.TestCase;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.jaxb.DefaultXMLAdapterExtensionPoint;
+import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import com.example.stock.StockExceptionTest;
+
/**
*
* @version $Rev$ $Date$
@@ -42,7 +50,20 @@ public class JAXWSJavaInterfaceProcessorTestCase extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- interfaceProcessor = new JAXWSJavaInterfaceProcessor();
+ DataBindingExtensionPoint db = new DefaultDataBindingExtensionPoint();
+ XMLAdapterExtensionPoint xa = new DefaultXMLAdapterExtensionPoint();
+ interfaceProcessor = new JAXWSJavaInterfaceProcessor(db, new JAXWSFaultExceptionMapper(db, xa), xa);
+ }
+
+ public void testWrapper() throws Exception {
+ DefaultJavaInterfaceFactory iFactory = new DefaultJavaInterfaceFactory();
+ JavaInterface contract = iFactory.createJavaInterface(StockExceptionTest.class);
+
+ interfaceProcessor.visitInterface(contract);
+ Operation op = contract.getOperations().get(0);
+ Assert.assertTrue(!op.isWrapperStyle());
+ Assert.assertEquals(new QName("http://www.example.com/stock", "stockQuoteOffer"), op.getWrapper().getInputWrapperElement().getQName());
+ Assert.assertEquals(new QName("http://www.example.com/stock", "stockQuoteOfferResponse"), op.getWrapper().getOutputWrapperElement().getQName());
}
/**
diff --git a/java/sca/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl b/java/sca/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl
index a3fd3817cb..4fee9e9756 100644
--- a/java/sca/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl
+++ b/java/sca/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl
@@ -40,14 +40,14 @@
</sequence>
</complexType>
</element>
- <element name="stockQuoteOfferResponse">
- <complexType>
- <sequence>
- <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer"/>
- </sequence>
- </complexType>
+ <!-- TUSCANY 2505, make the responseWrapper non-anonymous -->
+ <element name="stockQuoteOfferResponse" type="tns:StockQuoteOfferResponseType">
</element>
-
+ <complexType name="StockQuoteOfferResponseType">
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
<!-- Faults -->
<element name="InvalidSymbolFault">
<complexType>