diff options
Diffstat (limited to 'java/sca/modules')
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>
|