diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-14 12:50:24 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-14 12:50:24 +0000 |
commit | 5c00818fcc7cde81226e82dd7773d503fcc97302 (patch) | |
tree | c99c1037407b4c33024b438e54c96125ee167fbc /branches/sca-java-1.3.1/modules | |
parent | 626fdac30ca9826adc39357f6ff55aaebf360a7f (diff) |
TUSCANY-2505 - Fix up wrapper element names
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@685873 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.3.1/modules')
3 files changed, 40 insertions, 9 deletions
diff --git a/branches/sca-java-1.3.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/branches/sca-java-1.3.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java index 1e1a0c4e94..f779e04258 100644 --- a/branches/sca-java-1.3.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java +++ b/branches/sca-java-1.3.1/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/branches/sca-java-1.3.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java b/branches/sca-java-1.3.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java index 4eafc4e1ce..cdfac400e2 100644 --- a/branches/sca-java-1.3.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java +++ b/branches/sca-java-1.3.1/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/branches/sca-java-1.3.1/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl b/branches/sca-java-1.3.1/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl index a3fd3817cb..4fee9e9756 100644 --- a/branches/sca-java-1.3.1/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl +++ b/branches/sca-java-1.3.1/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>
|