From f64f55f30b79bb8970347ff6ff503ce19a8ccdaf Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 10 Sep 2008 10:16:04 +0000 Subject: TUSCANY-2398 doc/lit/bare wsdl on service and interface.java on reference git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@693770 13f79535-47bb-0310-9956-ffa450edef68 --- .../itest/databindings/jaxb/AClientService.java | 29 +++++ .../sca/itest/databindings/jaxb/AService.java | 32 ++++++ .../databindings/jaxb/impl/AClientServiceImpl.java | 38 ++++++ .../itest/databindings/jaxb/impl/AServiceImpl.java | 33 ++++++ .../src/main/resources/aservice.wsdl | 127 +++++++++++++++++++++ .../src/main/resources/doclitbarewsdl.composite | 37 ++++++ .../databindings/jaxb/DocLitBareWsdlTestCase.java | 67 +++++++++++ .../ws/wsdlgen/Interface2WSDLGenerator.java | 45 +++++++- .../ws/wsdlgen/WSDLDefinitionGenerator.java | 3 +- .../transformers/Input2InputTransformer.java | 18 +-- .../transformers/Output2OutputTransformer.java | 11 +- .../java/jaxws/JAXWSJavaInterfaceProcessor.java | 7 +- .../jaxws/JAXWSJavaInterfaceProcessorTestCase.java | 3 +- 13 files changed, 428 insertions(+), 22 deletions(-) create mode 100644 branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java create mode 100644 branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java create mode 100644 branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java create mode 100644 branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java create mode 100644 branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl create mode 100644 branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite create mode 100644 branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java diff --git a/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java new file mode 100644 index 0000000000..7f9b62f9b4 --- /dev/null +++ b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AClientService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.tuscany.sca.itest.databindings.jaxb; + +import org.osoa.sca.annotations.Remotable; + +/** + * The interface for AClientService. + */ +@Remotable +public interface AClientService { + public String getGreetingsForward(String name); +} diff --git a/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java new file mode 100644 index 0000000000..1762812c1f --- /dev/null +++ b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/AService.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.tuscany.sca.itest.databindings.jaxb; + +import javax.jws.soap.SOAPBinding; + +import org.osoa.sca.annotations.Remotable; + +/** + * The interface for AService. + */ +@Remotable +@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) +public interface AService { + public String getGreetings(String name); +} diff --git a/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java new file mode 100644 index 0000000000..8b484e93f0 --- /dev/null +++ b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AClientServiceImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.tuscany.sca.itest.databindings.jaxb.impl; + +import org.apache.tuscany.sca.itest.databindings.jaxb.AClientService; +import org.apache.tuscany.sca.itest.databindings.jaxb.AService; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements AService. + */ +@Service(AClientService.class) +public class AClientServiceImpl implements AClientService { + + @Reference + protected AService aService; + + public String getGreetingsForward(String name) { + return aService.getGreetings(name); + } +} diff --git a/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java new file mode 100644 index 0000000000..4a35d41c04 --- /dev/null +++ b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/AServiceImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.tuscany.sca.itest.databindings.jaxb.impl; + +import org.apache.tuscany.sca.itest.databindings.jaxb.AService; +import org.osoa.sca.annotations.Service; + +/** + * This class implements AService. + */ +@Service(AService.class) +public class AServiceImpl implements AService { + + public String getGreetings(String name) { + return "Hello " + name; + } +} diff --git a/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl new file mode 100644 index 0000000000..4a37094fa3 --- /dev/null +++ b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/resources/aservice.wsdl @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite new file mode 100644 index 0000000000..5a7873d07a --- /dev/null +++ b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/main/resources/doclitbarewsdl.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java new file mode 100644 index 0000000000..744bf20494 --- /dev/null +++ b/branches/sca-java-1.3.2/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/DocLitBareWsdlTestCase.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.tuscany.sca.itest.databindings.jaxb; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * @version $Rev$ $Date$ + */ +public class DocLitBareWsdlTestCase { + + private static SCADomain domain; + + /** + * Runs once before running the tests + */ + @BeforeClass + public static void setUp() throws Exception { + try { + domain = SCADomain.newInstance("doclitbarewsdl.composite"); + } catch (Throwable e) { + // @Ignore("TUSCANY-2398") + e.printStackTrace(); + } + } + + /** + * Runs once after running the tests + */ + @AfterClass + public static void tearDown() { + if (domain != null) { + domain.close(); + } + } + + // @Ignore("TUSCANY-2398") + @Test + public void testDocLitBareWsdl() throws Exception { + AClientService client = domain.getService(AClientService.class, "AClientComponent"); + String name = "Pandu"; + String resp = client.getGreetingsForward(name); + Assert.assertEquals("Hello " + name, resp); + } +} diff --git a/branches/sca-java-1.3.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/branches/sca-java-1.3.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java index be87ec611b..1047331924 100644 --- a/branches/sca-java-1.3.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java +++ b/branches/sca-java-1.3.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java @@ -236,6 +236,10 @@ public class Interface2WSDLGenerator { javax.wsdl.Operation operation = generateOperation(definition, op, helpers, wrappers); portType.addOperation(operation); String action = ((JavaOperation)op).getAction(); + if ((action == null || "".equals(action)) && !op.isWrapperStyle() && op.getWrapper() == null) { + // Bare style + action = "urn:" + op.getName(); + } BindingOperation bindingOp = definitionGenerator.createBindingOperation(definition, operation, action); binding.addBindingOperation(bindingOp); } @@ -307,7 +311,25 @@ public class Interface2WSDLGenerator { if (entry.getValue().size() == 1 && entry.getValue().get(0).getQName() == null) { // special case for global fault element QName typeName = entry.getValue().get(0).getType().getQName(); - wrapper.setAttribute("type", typeName.getLocalPart()); + String nsURI = typeName.getNamespaceURI(); + if ("".equals(nsURI)) { + wrapper.setAttribute("type", typeName.getLocalPart()); + addSchemaImport(schema, "", schemaDoc); + } else if (targetNS.equals(nsURI)) { + wrapper.setAttribute("type", typeName.getLocalPart()); + } else if (SCHEMA_NS.equals(nsURI)) { + wrapper.setAttribute("type", "xs:" + typeName.getLocalPart()); + } else { + Map prefixMap = prefixMaps.get(schema); + String prefix = prefixMap.get(nsURI); + if (prefix == null) { + prefix = "ns" + i++; + prefixMap.put(nsURI, prefix); + schema.setAttributeNS(XMLNS_NS, "xmlns:" + prefix, nsURI); + addSchemaImport(schema, nsURI, schemaDoc); + } + wrapper.setAttribute("type", prefix + ":" + typeName.getLocalPart()); + } } else { // normal wrapper containing type definition inline Element complexType = schemaDoc.createElementNS(SCHEMA_NS, "xs:complexType"); @@ -496,6 +518,7 @@ public class Interface2WSDLGenerator { inputMsg.setUndefined(false); definition.addMessage(inputMsg); + List elements = null; // FIXME: By default, java interface is mapped to doc-lit-wrapper style WSDL if (op.getWrapper() != null) { // Generate doc-lit-wrapper style @@ -505,6 +528,11 @@ public class Interface2WSDLGenerator { int i = 0; for (DataType d : op.getInputType().getLogical()) { inputMsg.addPart(generatePart(definition, d, "arg" + i)); + elements = new ArrayList(); + ElementInfo element = getElementInfo(d.getPhysical(), d, null, helpers); + elements.add(element); + QName elementName = ((XMLType)d.getLogical()).getElementName(); + wrappers.put(elementName, elements); i++; } } @@ -522,7 +550,15 @@ public class Interface2WSDLGenerator { if (op.getWrapper() != null) { outputMsg.addPart(generateWrapperPart(definition, op, helpers, wrappers, false)); } else { - outputMsg.addPart(generatePart(definition, op.getOutputType(), "return")); + DataType outputType = op.getOutputType(); + outputMsg.addPart(generatePart(definition, outputType, "return")); + if (outputType != null) { + elements = new ArrayList(); + ElementInfo element = getElementInfo(outputType.getPhysical(), outputType, null, helpers); + elements.add(element); + QName elementName = ((XMLType)outputType.getLogical()).getElementName(); + wrappers.put(elementName, elements); + } } output.setMessage(outputMsg); @@ -546,17 +582,16 @@ public class Interface2WSDLGenerator { } fault.setMessage(faultMsg); operation.addFault(fault); - List elements = null; if (faultType.getLogical().getPhysical() != faultType.getPhysical()) { // create special wrapper for type indirection to real fault bean - elements = new ArrayList(1); DataType logical = faultType.getLogical(); + elements = new ArrayList(); elements.add(getElementInfo(logical.getPhysical(), logical, null, helpers)); } else { // convert synthesized fault bean to a wrapper type - elements = new ArrayList(); for (DataType propDT: op.getFaultBeans().get(faultName)) { XMLType logical = propDT.getLogical(); + elements = new ArrayList(); elements.add(getElementInfo(propDT.getPhysical(), propDT, logical.getElementName(), helpers)); } } diff --git a/branches/sca-java-1.3.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java b/branches/sca-java-1.3.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java index f99947a52e..d0b79f9b0e 100644 --- a/branches/sca-java-1.3.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java +++ b/branches/sca-java-1.3.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java @@ -146,7 +146,8 @@ public class WSDLDefinitionGenerator { try { for (Iterator oi = portType.getOperations().iterator(); oi.hasNext();) { Operation operation = (Operation)oi.next(); - BindingOperation bindingOperation = createBindingOperation(definition, operation, ""); + BindingOperation bindingOperation = + createBindingOperation(definition, operation, "urn:" + operation.getName()); binding.addBindingOperation(bindingOperation); } } catch (WSDLException e) { diff --git a/branches/sca-java-1.3.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java b/branches/sca-java-1.3.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java index 71694c0a0a..fb5f939edb 100644 --- a/branches/sca-java-1.3.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java +++ b/branches/sca-java-1.3.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java @@ -133,7 +133,8 @@ public class Input2InputTransformer extends BaseTransformer // Check if the source operation is wrapped DataType> sourceType = context.getSourceDataType(); Operation sourceOp = context.getSourceOperation(); - boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle(); + boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle() && sourceOp.getWrapper() != null; + boolean sourceBare = sourceOp != null && !sourceOp.isWrapperStyle() && sourceOp.getWrapper() == null; // Find the wrapper handler for source data WrapperHandler sourceWrapperHandler = null; @@ -143,19 +144,20 @@ public class Input2InputTransformer extends BaseTransformer // Check if the target operation is wrapped DataType> targetType = context.getTargetDataType(); Operation targetOp = (Operation)context.getTargetOperation(); - boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle(); + boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle() && targetOp.getWrapper() != null; + boolean targetBare = targetOp != null && !targetOp.isWrapperStyle() && targetOp.getWrapper() == null; // Find the wrapper handler for target data WrapperHandler targetWrapperHandler = null; String targetDataBinding = getDataBinding(targetOp); targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped); - if ((!sourceWrapped) && targetWrapped) { + if ((!sourceWrapped && !sourceBare) && targetWrapped) { // Unwrapped --> Wrapped WrapperInfo wrapper = targetOp.getWrapper(); - ElementInfo wrapperElement = wrapper.getInputWrapperElement(); + // ElementInfo wrapperElement = wrapper.getInputWrapperElement(); - Class targetWrapperClass = wrapper != null ? wrapper.getInputWrapperClass() : null; + // Class targetWrapperClass = wrapper != null ? wrapper.getInputWrapperClass() : null; if (source == null) { // Empty child elements @@ -207,14 +209,14 @@ public class Input2InputTransformer extends BaseTransformer true); return new Object[] {targetWrapper}; - } else if (sourceWrapped && (!targetWrapped)) { + } else if (sourceWrapped && (!targetWrapped && !targetBare)) { // Wrapped to Unwrapped Object sourceWrapper = source[0]; Object[] target = null; - List childElements = sourceOp.getWrapper().getInputChildElements(); + // List childElements = sourceOp.getWrapper().getInputChildElements(); if (targetWrapperHandler != null) { - ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement(); + // ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement(); // FIXME: This is a workaround for the wsdless support as it passes in child elements // under the wrapper that only matches by position if (sourceWrapperHandler.isInstance(sourceWrapper, sourceOp, true)) { diff --git a/branches/sca-java-1.3.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java b/branches/sca-java-1.3.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java index 71253f00b4..8d586905c4 100644 --- a/branches/sca-java-1.3.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java +++ b/branches/sca-java-1.3.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java @@ -154,7 +154,8 @@ public class Output2OutputTransformer extends BaseTransformer im try { DataType sourceType = context.getSourceDataType(); Operation sourceOp = context.getSourceOperation(); - boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle(); + boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle() && sourceOp.getWrapper() != null; + boolean sourceBare = sourceOp != null && !sourceOp.isWrapperStyle() && sourceOp.getWrapper() == null; WrapperHandler sourceWrapperHandler = null; String sourceDataBinding = getDataBinding(sourceOp); @@ -162,12 +163,14 @@ public class Output2OutputTransformer extends BaseTransformer im DataType targetType = context.getTargetDataType(); Operation targetOp = (Operation)context.getTargetOperation(); - boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle(); + boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle() && targetOp.getWrapper() != null; + boolean targetBare = targetOp != null && !targetOp.isWrapperStyle() && targetOp.getWrapper() == null; + WrapperHandler targetWrapperHandler = null; String targetDataBinding = getDataBinding(targetOp); targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped); - if ((!sourceWrapped) && targetWrapped) { + if ((!sourceWrapped &&!sourceBare) && targetWrapped) { // Unwrapped --> Wrapped WrapperInfo wrapper = targetOp.getWrapper(); ElementInfo wrapperElement = wrapper.getOutputWrapperElement(); @@ -211,7 +214,7 @@ public class Output2OutputTransformer extends BaseTransformer im child = mediator.mediate(response, sourceType.getLogical(), argType, context.getMetadata()); targetWrapperHandler.setChildren(targetWrapper, new Object[] {child}, targetOp, false); return targetWrapper; - } else if (sourceWrapped && (!targetWrapped)) { + } else if (sourceWrapped && (!targetWrapped && !targetBare)) { // Wrapped to Unwrapped Object sourceWrapper = response; List childElements = sourceOp.getWrapper().getOutputChildElements(); diff --git a/branches/sca-java-1.3.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/branches/sca-java-1.3.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java index f779e04258..d1b36fa17c 100644 --- a/branches/sca-java-1.3.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java +++ b/branches/sca-java-1.3.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java @@ -125,8 +125,11 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor { boolean bare = false; if (methodSOAPBinding != null) { bare = methodSOAPBinding.parameterStyle() == SOAPBinding.ParameterStyle.BARE; - // For BARE parameter style, the data is in the wrapped format already - operation.setWrapperStyle(bare); + if(bare) { + // For BARE parameter style, the data won't be unwrapped + // The wrapper should be null + operation.setWrapperStyle(false); + } documentStyle = methodSOAPBinding.style() == Style.DOCUMENT; } diff --git a/branches/sca-java-1.3.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java b/branches/sca-java-1.3.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java index cdfac400e2..108d283584 100644 --- a/branches/sca-java-1.3.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java +++ b/branches/sca-java-1.3.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java @@ -36,7 +36,6 @@ import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import com.example.stock.StockExceptionTest; - /** * * @version $Rev$ $Date$ @@ -91,7 +90,7 @@ public class JAXWSJavaInterfaceProcessorTestCase extends TestCase { op = op2; } - assertTrue(op.isWrapperStyle()); + assertTrue(!op.isWrapperStyle() && op.getWrapper() == null); if ("M2".equals(op2.getName())) { op = op2; -- cgit v1.2.3