Author: antelder
Date: Sat Aug 11 11:35:08 2007
New Revision: 564955
URL: http://svn.apache.org/viewvc?view=rev&rev=564955
Log:
First cut of ws binding supporting on-the-fly wsdl generation. Doesn't work the
way it should yet, but i haven't got the better way going yet so this gives
those waiting for this feature something to use in the meantime
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelper.java
(with props)
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelperTestCase.java
(with props)
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Bar.java
(with props)
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Echo.java
(with props)
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoComponent.java
(with props)
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoImpl.java
(with props)
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Foo.java
(with props)
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDLTestCase.java
(with props)
Removed:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDLTestCaseFIXME.java
Modified:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceBindingProvider.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceBindingProvider.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceClient.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceServlet.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
Modified:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceBindingProvider.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceBindingProvider.java?view=diff&rev=564955&r1=564954&r2=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceBindingProvider.java
(original)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceBindingProvider.java
Sat Aug 11 11:35:08 2007
@@ -24,6 +24,7 @@
import org.apache.tuscany.sca.http.ServletHost;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider2;
@@ -50,6 +51,9 @@
InterfaceContract contract = wsBinding.getBindingInterfaceContract();
if (contract == null) {
contract =
reference.getInterfaceContract().makeUnidirectional(wsBinding.isCallback());
+ if ((contract instanceof JavaInterfaceContract)) {
+ contract =
Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract);
+ }
wsBinding.setBindingInterfaceContract(contract);
}
Modified:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceBindingProvider.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceBindingProvider.java?view=diff&rev=564955&r1=564954&r2=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceBindingProvider.java
(original)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceBindingProvider.java
Sat Aug 11 11:35:08 2007
@@ -23,6 +23,7 @@
import org.apache.tuscany.sca.http.ServletHost;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.ServiceBindingProvider2;
@@ -46,6 +47,9 @@
InterfaceContract contract = wsBinding.getBindingInterfaceContract();
if (contract == null) {
contract =
service.getInterfaceContract().makeUnidirectional(wsBinding.isCallback());
+ if ((contract instanceof JavaInterfaceContract)) {
+ contract =
Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract);
+ }
wsBinding.setBindingInterfaceContract(contract);
}
Modified:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceClient.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceClient.java?view=diff&rev=564955&r1=564954&r2=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceClient.java
(original)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceClient.java
Sat Aug 11 11:35:08 2007
@@ -167,7 +167,7 @@
protected EndpointReference getPortLocationEPR(WebServiceBinding binding) {
String ep = binding.getURI();
if (ep == null && binding.getPort() != null) {
- List wsdlPortExtensions =
binding.getPort().getExtensibilityElements();
+ List<?> wsdlPortExtensions =
binding.getPort().getExtensibilityElements();
for (final Object extension : wsdlPortExtensions) {
if (extension instanceof SOAPAddress) {
ep = ((SOAPAddress)extension).getLocationURI();
Modified:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java?view=diff&rev=564955&r1=564954&r2=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
(original)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
Sat Aug 11 11:35:08 2007
@@ -211,7 +211,7 @@
*/
protected URI getEndpoint(Port wsdlPort) {
if (wsdlPort != null) {
- List wsdlPortExtensions = wsdlPort.getExtensibilityElements();
+ List<?> wsdlPortExtensions = wsdlPort.getExtensibilityElements();
for (Object extension : wsdlPortExtensions) {
if (extension instanceof SOAPAddress) {
return
URI.create(((SOAPAddress)extension).getLocationURI());
@@ -287,7 +287,7 @@
}
protected void initAxisOperations(AxisService axisService) {
- for (Iterator i = axisService.getOperations(); i.hasNext();) {
+ for (Iterator<?> i = axisService.getOperations(); i.hasNext();) {
AxisOperation axisOp = (AxisOperation)i.next();
Operation op = getOperation(axisOp);
if (op != null) {
@@ -334,16 +334,16 @@
if (isConversational()) {
SOAPHeader header = inMC.getEnvelope().getHeader();
if (header != null) {
- Iterator i = header.getChildrenWithName(new
QName("http://www.w3.org/2005/08/addressing", "From"));
+ Iterator<?> i = header.getChildrenWithName(new
QName("http://www.w3.org/2005/08/addressing", "From"));
for (; i.hasNext();) {
Object a = i.next();
if (a instanceof OMElement) {
OMElement ao = (OMElement)a;
- for (Iterator rpI =
+ for (Iterator<?> rpI =
ao.getChildrenWithName(new
QName("http://www.w3.org/2005/08/addressing",
"ReferenceParameters")); rpI.hasNext();) {
OMElement rpE = (OMElement)rpI.next();
- for (Iterator cidI =
+ for (Iterator<?> cidI =
rpE.getChildrenWithName(Axis2BindingInvoker.CONVERSATION_ID_REFPARM_QN);
cidI.hasNext();) {
OMElement cidE = (OMElement)cidI.next();
conversationID = cidE.getText();
@@ -367,12 +367,12 @@
if (contract instanceof RuntimeComponentService &&
contract.getInterfaceContract().getCallbackInterface() != null) {
SOAPHeader header = inMC.getEnvelope().getHeader();
if (header != null) {
- Iterator i = header.getChildrenWithName(new
QName("http://www.w3.org/2005/08/addressing", "From"));
+ Iterator<?> i = header.getChildrenWithName(new
QName("http://www.w3.org/2005/08/addressing", "From"));
for (; i.hasNext();) {
Object a = i.next();
if (a instanceof OMElement) {
OMElement ao = (OMElement)a;
- for (Iterator adI =
+ for (Iterator<?> adI =
ao.getChildrenWithName(new
QName("http://www.w3.org/2005/08/addressing", "Address")); adI
.hasNext();) {
OMElement adE = (OMElement)adI.next();
Modified:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceServlet.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceServlet.java?view=diff&rev=564955&r1=564954&r2=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceServlet.java
(original)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceServlet.java
Sat Aug 11 11:35:08 2007
@@ -129,7 +129,7 @@
return null;
}
- public Set getResourcePaths(String path) {
+ public Set<?> getResourcePaths(String path) {
return Collections.emptySet();
}
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelper.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelper.java?view=auto&rev=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelper.java
(added)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelper.java
Sat Aug 11 11:35:08 2007
@@ -0,0 +1,218 @@
+/*
+ * 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.binding.axis2;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.impl.InvalidWSDLException;
+import
org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.XMLDocumentHelper;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.java2wsdl.Java2WSDLBuilder;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+/**
+ * Utility methods to create WSDL objects from Java interfaces
+ */
+public class Java2WSDLHelper {
+
+ /**
+ * Create a WSDLInterfaceContract from a JavaInterfaceContract
+ */
+ public static WSDLInterfaceContract
createWSDLInterfaceContract(JavaInterfaceContract contract) {
+ JavaInterface iface = (JavaInterface)contract.getInterface();
+ Definition def =
Java2WSDLHelper.createDefinition(iface.getJavaClass());
+
+ DefaultWSDLFactory wsdlFactory = new DefaultWSDLFactory();
+
+ WSDLInterfaceContract wsdlContract =
wsdlFactory.createWSDLInterfaceContract();
+ WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
+
+ wsdlContract.setInterface(wsdlInterface);
+ WSDLDefinition wsdlDefinition = new
DefaultWSDLFactory().createWSDLDefinition();
+ wsdlDefinition.setDefinition(def);
+ wsdlInterface.setWsdlDefinition(wsdlDefinition);
+ wsdlInterface.setRemotable(true);
+
wsdlInterface.setConversational(contract.getInterface().isConversational());
+ wsdlInterface.setUnresolved(false);
+ wsdlInterface.setRemotable(true);
+ PortType portType =
(PortType)def.getAllPortTypes().values().iterator().next();
+ wsdlInterface.setPortType(portType);
+
+ readInlineSchemas(def, wsdlDefinition.getInlinedSchemas());
+
+ try {
+ for (Operation op : iface.getOperations()) {
+ Operation clonedOp = (Operation)op.clone();
+ clonedOp.setDataBinding(null);
+ for (DataType<?> dt : clonedOp.getInputType().getLogical()) {
+ dt.setDataBinding(null);
+ }
+ clonedOp.getOutputType().setDataBinding(null);
+ for (DataType<?> dt : clonedOp.getFaultTypes()) {
+ dt.setDataBinding(null);
+ }
+ clonedOp.setWrapperStyle(true);
+ javax.wsdl.Operation wsdlOp =
portType.getOperation(op.getName(), null, null);
+ WSDLOperationIntrospectorImpl opx =
+ new WSDLOperationIntrospectorImpl(wsdlFactory, wsdlOp,
wsdlDefinition.getInlinedSchemas(), null,
+ null);
+ clonedOp.setWrapper(opx.getWrapper().getWrapperInfo());
+
+ wsdlInterface.getOperations().add(clonedOp);
+ }
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ } catch (InvalidWSDLException e) {
+ throw new RuntimeException(e);
+ }
+
+ return wsdlContract;
+ }
+
+ protected static void readInlineSchemas(Definition definition,
XmlSchemaCollection schemaCollection) {
+ Types types = definition.getTypes();
+ if (types != null) {
+ for (Object ext : types.getExtensibilityElements()) {
+ if (ext instanceof Schema) {
+ Element element = ((Schema)ext).getElement();
+
schemaCollection.setBaseUri(((Schema)ext).getDocumentBaseURI());
+ schemaCollection.read(element, element.getBaseURI());
+ }
+ }
+ }
+ for (Object imports : definition.getImports().values()) {
+ List<?> impList = (List<?>)imports;
+ for (Object i : impList) {
+ javax.wsdl.Import anImport = (javax.wsdl.Import)i;
+ // Read inline schemas
+ if (anImport.getDefinition() != null) {
+ readInlineSchemas(anImport.getDefinition(),
schemaCollection);
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a WSDL4J Definition object from a Java interface
+ */
+ protected static Definition createDefinition(Class<?> javaInterface) {
+
+ String className = javaInterface.getName();
+ ClassLoader cl = javaInterface.getClassLoader();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ Java2WSDLBuilder builder = new Java2WSDLBuilder(os, className, cl);
+
+ try {
+ builder.generateWSDL();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ try {
+
+ WSDLReader reader =
javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ reader.setFeature("javax.wsdl.importDocuments", true);
+
+ WSDLLocatorImpl locator = new WSDLLocatorImpl(new
ByteArrayInputStream(os.toByteArray()));
+ Definition definition = reader.readWSDL(locator);
+
+ // remove the soap 1.2 port as we don't use that (yet)
+ Service service =
(Service)definition.getServices().values().iterator().next();
+ Map<?,?> ports = service.getPorts();
+ for (Object o : ports.keySet()) {
+ if (((String)o).endsWith("SOAP12port")) {
+ Port p = (Port) ports.remove(o);
+ definition.removeBinding(p.getBinding().getQName());
+ break;
+ }
+ }
+
+ return definition;
+
+ } catch (WSDLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
+
+class WSDLLocatorImpl implements WSDLLocator {
+ private InputStream inputStream;
+ private String base = "http://";
+ private String latestImportURI;
+
+ public WSDLLocatorImpl(InputStream is) {
+ this.inputStream = is;
+ }
+
+ public void close() {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+
+ public InputSource getBaseInputSource() {
+ try {
+ return XMLDocumentHelper.getInputSource(new URL(base),
inputStream);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public String getBaseURI() {
+ return base;
+ }
+
+ public InputSource getImportInputSource(String parentLocation, String
importLocation) {
+ return null;
+ }
+
+ public String getLatestImportURI() {
+ return latestImportURI;
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelperTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelperTestCase.java?view=auto&rev=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelperTestCase.java
(added)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelperTestCase.java
Sat Aug 11 11:35:08 2007
@@ -0,0 +1,74 @@
+/*
+ * 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.binding.axis2;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+
+public class Java2WSDLHelperTestCase extends TestCase {
+
+ public void testCreateDefinition() {
+ Definition definition =
Java2WSDLHelper.createDefinition(HelloWorld.class);
+ assertNotNull(definition);
+
+ Map portTypes = definition.getPortTypes();
+ assertEquals(1, portTypes.size());
+
+ PortType portType = (PortType)portTypes.values().iterator().next();
+ assertEquals("HelloWorldPortType", portType.getQName().getLocalPart());
+ assertEquals("http://axis2.binding.sca.tuscany.apache.org",
portType.getQName().getNamespaceURI());
+
+ List<?> ops = portType.getOperations();
+ assertEquals(1, ops.size());
+
+ Operation operation = (Operation)ops.get(0);
+ assertEquals("sayHello", operation.getName());
+ }
+
+
+ public void testCreateWSDLInterfaceContract() throws
InvalidInterfaceException {
+ DefaultJavaInterfaceFactory factory = new
DefaultJavaInterfaceFactory();
+ JavaInterfaceContract javaIC = factory.createJavaInterfaceContract();
+ javaIC.setInterface(factory.createJavaInterface(HelloWorld.class));
+ WSDLInterfaceContract wsdlIC =
Java2WSDLHelper.createWSDLInterfaceContract(javaIC);
+ assertNotNull(wsdlIC);
+ WSDLInterface wsdlInterface = (WSDLInterface)wsdlIC.getInterface();
+ assertNotNull(wsdlInterface);
+ assertEquals(1, wsdlInterface.getOperations().size());
+ assertEquals("sayHello",
wsdlInterface.getOperations().get(0).getName());
+ assertNotNull(wsdlInterface.getPortType());
+ }
+
+}
+
+interface HelloWorld {
+ public String sayHello(String s);
+}
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelperTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Java2WSDLHelperTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Bar.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Bar.java?view=auto&rev=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Bar.java
(added)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Bar.java
Sat Aug 11 11:35:08 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.binding.axis2.itests;
+
+import java.io.Serializable;
+
+public class Bar implements Serializable {
+
+ private String s;
+ private int x;
+ private Integer y;
+ public String getS() {
+ return s;
+ }
+ public void setS(String s) {
+ this.s = s;
+ }
+ public int getX() {
+ return x;
+ }
+ public void setX(int x) {
+ this.x = x;
+ }
+ public Integer getY() {
+ return y;
+ }
+ public void setY(Integer y) {
+ this.y = y;
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Bar.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Bar.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Echo.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Echo.java?view=auto&rev=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Echo.java
(added)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Echo.java
Sat Aug 11 11:35:08 2007
@@ -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.binding.axis2.itests;
+
+import org.osoa.sca.annotations.Remotable;
+
[EMAIL PROTECTED]
+public interface Echo {
+
+ public Foo echoFoo(Foo foo);
+
+}
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Echo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Echo.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoComponent.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoComponent.java?view=auto&rev=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoComponent.java
(added)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoComponent.java
Sat Aug 11 11:35:08 2007
@@ -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.binding.axis2.itests;
+
+import org.osoa.sca.annotations.Reference;
+
+public class EchoComponent implements Echo {
+
+ @Reference
+ public Echo echoWS;
+
+ public Foo echoFoo(Foo foo) {
+ return echoWS.echoFoo(foo);
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoComponent.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoImpl.java?view=auto&rev=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoImpl.java
(added)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoImpl.java
Sat Aug 11 11:35:08 2007
@@ -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.binding.axis2.itests;
+
+
+public class EchoImpl implements Echo {
+
+ public Foo echoFoo(Foo foo) {
+ return foo;
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/EchoImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Foo.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Foo.java?view=auto&rev=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Foo.java
(added)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Foo.java
Sat Aug 11 11:35:08 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.binding.axis2.itests;
+
+import java.io.Serializable;
+
+public class Foo implements Serializable {
+
+ private Bar[] bars;
+
+ public Bar[] getBars() {
+ return bars;
+ }
+
+ public void setBars(Bar[] bars) {
+ this.bars = bars;
+ }
+}
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Foo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/Foo.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDLTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDLTestCase.java?view=auto&rev=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDLTestCase.java
(added)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDLTestCase.java
Sat Aug 11 11:35:08 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.binding.axis2.itests ;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class HelloWorldNoWSDLTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ public void testHelloWorld() throws Exception {
+ HelloWorld helloWorld = domain.getService(HelloWorld.class,
"HelloWorldComponent");
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+
+ /**
+ * Test a a WS call with a complex type
+ */
+ public void testEchoFoo() throws Exception {
+ Echo echo = domain.getService(Echo.class, "EchoComponent");
+
+ Foo f = new Foo();
+ Bar b1 = new Bar();
+ b1.setS("petra");
+ b1.setX(1);
+ b1.setY(new Integer(2));
+ Bar b2 = new Bar();
+ b2.setS("beate");
+ b2.setX(3);
+ b2.setY(new Integer(4));
+ f.setBars(new Bar[] { b1, b2} );
+
+ Foo f2 = echo.echoFoo(f);
+
+ assertEquals("petra", f2.getBars()[0].getS());
+ assertEquals(1, f2.getBars()[0].getX());
+ assertEquals(2, f2.getBars()[0].getY().intValue());
+ assertEquals("beate", f2.getBars()[1].getS());
+ assertEquals(3, f2.getBars()[1].getX());
+ assertEquals(4, f2.getBars()[1].getY().intValue());
+
+ }
+
+ protected void setUp() throws Exception {
+ domain =
SCADomain.newInstance("org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDLTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDLTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite?view=diff&rev=564955&r1=564954&r2=564955
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
(original)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
Sat Aug 11 11:35:08 2007
@@ -21,24 +21,40 @@
name="HelloWorldNoWSDL">
<service name="helloWorld" promote="HelloWorldService">
- <!-- interface.wsdl
interface="http://helloworld#wsdl.interface(HelloWorld)" / -->
- <interface.java
interface="org.apache.tuscany.sca.binding.axis2.itests.HelloWorld" />
+ <!-- interface.java
interface="org.apache.tuscany.sca.binding.axis2.itests.HelloWorld" / -->
<binding.ws/>
</service>
<component name="HelloWorldService">
- <implementation.java
class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldService"/>
+ <implementation.java
class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldService"/>
</component>
<component name="HelloWorldComponent">
- <implementation.java
class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldComponent"/>
+ <implementation.java
class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldComponent"/>
<reference name="helloWorldWS" />
</component>
<reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
<!-- interface.wsdl
interface="http://helloworld#wsdl.interface(HelloWorld)" / -->
- <interface.java
interface="org.apache.tuscany.sca.binding.axis2.itests.HelloWorld" />
+ <!-- interface.java
interface="org.apache.tuscany.sca.binding.axis2.itests.HelloWorld" / -->
<binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </reference>
+
+ <service name="Echo" promote="EchoService">
+ <binding.ws/>
+ </service>
+
+ <component name="EchoService">
+ <implementation.java
class="org.apache.tuscany.sca.binding.axis2.itests.EchoImpl"/>
+ </component>
+
+ <component name="EchoComponent">
+ <implementation.java
class="org.apache.tuscany.sca.binding.axis2.itests.EchoComponent"/>
+ <reference name="echoWS" />
+ </component>
+
+ <reference name="echoWS" promote="EchoComponent/echoWS">
+ <binding.ws uri="http://localhost:8085/EchoService/Echo"/>
</reference>
</composite>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]