From a46908c4cdf082333ef9f59f6d6a37bdc34987e7 Mon Sep 17 00:00:00 2001 From: slaws Date: Fri, 16 Apr 2010 12:54:46 +0000 Subject: Split the jaxws ws binding into a generic bit and an RI specific bit. Problems committing the deletes from binding-ws-runtime-ri so doing it in stages git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@934855 13f79535-47bb-0310-9956-ffa450edef68 --- .../binding-ws-runtime-jaxws/META-INF/MANIFEST.MF | 1 + .../sca/binding/ws/jaxws/JAXWSBindingInvoker.java | 2 +- .../sca/binding/ws/jaxws/JAXWSBindingProvider.java | 151 +++++++++++++++++++ .../ws/jaxws/JAXWSBindingProviderFactory.java | 68 --------- .../ws/jaxws/JAXWSReferenceBindingProvider.java | 74 --------- .../ws/jaxws/JAXWSServiceBindingProvider.java | 166 --------------------- ...che.tuscany.sca.provider.BindingProviderFactory | 20 --- .../sca/binding/ws/axis2/WSDLPortTestCase.java | 51 ------- .../binding/ws/axis2/helloworld/HelloWorld.java | 29 ---- .../ws/axis2/helloworld/HelloWorldClient.java | 35 ----- .../ws/axis2/helloworld/HelloWorldService.java | 30 ---- .../binding/ws/axis2/wsdlport/helloworld.composite | 39 ----- .../sca/binding/ws/axis2/wsdlport/helloworld.wsdl | 80 ---------- 13 files changed, 153 insertions(+), 593 deletions(-) create mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingProvider.java delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingProviderFactory.java delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSReferenceBindingProvider.java delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.composite delete mode 100644 sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.wsdl (limited to 'sca-java-2.x') diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/META-INF/MANIFEST.MF index a095f0d289..ac68264fcb 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/META-INF/MANIFEST.MF +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/META-INF/MANIFEST.MF @@ -52,3 +52,4 @@ Import-Package: javax.security.auth.callback;resolution:=optional, Bundle-SymbolicName: org.apache.tuscany.sca.binding.ws.jaxws Bundle-DocURL: http://www.apache.org/ Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 +Export-Package: org.apache.tuscany.sca.binding.ws.jaxws;version="2.0.0" diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java index fcf4f472ff..65bcc0cfd9 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java @@ -51,7 +51,7 @@ import org.apache.tuscany.sca.invocation.Message; import org.w3c.dom.Node; /** - * Axis2BindingInvoker uses an Axis2 OperationClient to invoke a remote web service + * Uses JAXWS Dispatch to invoke a remote web service * * @version $Rev$ $Date$ */ diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingProvider.java new file mode 100644 index 0000000000..98aa0b8d2a --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingProvider.java @@ -0,0 +1,151 @@ +/* + * 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.ws.jaxws; + +import javax.xml.namespace.QName; +import javax.xml.soap.Detail; +import javax.xml.soap.DetailEntry; +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPFactory; +import javax.xml.soap.SOAPFault; +import javax.xml.soap.SOAPMessage; +import javax.xml.ws.Provider; +import javax.xml.ws.ServiceMode; +import javax.xml.ws.WebServiceProvider; +import javax.xml.ws.Service.Mode; + +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; +import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; +import org.apache.tuscany.sca.host.http.ServletHost; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.util.FaultException; +import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +import org.oasisopen.sca.ServiceRuntimeException; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +@WebServiceProvider +@ServiceMode(Mode.MESSAGE) +public class JAXWSBindingProvider implements Provider { + private MessageFactory messageFactory; + private RuntimeEndpoint endpoint; + private WebServiceBinding wsBinding; + private javax.xml.soap.MessageFactory soapMessageFactory; + private SOAPFactory soapFactory; + + public JAXWSBindingProvider(RuntimeEndpoint endpoint, + ServletHost servletHost, + FactoryExtensionPoint modelFactories, + DataBindingExtensionPoint dataBindings) { + + this.messageFactory = modelFactories.getFactory(MessageFactory.class); + + this.soapMessageFactory = modelFactories.getFactory(javax.xml.soap.MessageFactory.class); + this.soapFactory = modelFactories.getFactory(SOAPFactory.class); + + // soapMessageFactory = javax.xml.soap.MessageFactory.newInstance(); + // soapFactory = SOAPFactory.newInstance(); + + this.endpoint = endpoint; + this.wsBinding = (WebServiceBinding)endpoint.getBinding(); + + // A WSDL document should always be present in the binding + if (wsBinding.getWSDLDocument() == null) { + throw new ServiceRuntimeException("No WSDL document for " + endpoint.getURI()); + } + + // Set to use the DOM data binding + InterfaceContract contract = wsBinding.getBindingInterfaceContract(); + contract.getInterface().resetDataBinding(Node.class.getName()); + + // Can we safely assume there is only one port because you configure + // a binding in the following ways: + // 1/ default - one port generated = host domain : host port / structural path + // 2/ uri="absolute addr" - one port generated = host domain : uri port / uri path + // 3/ uri="relative addr" - one port generated = host domain : host port / structural path / relative path + // 4/ wsdl.binding - one port generated = host domain : host port / structural path + // 5/ wsdl.port - one port generated = host domain : port port / port path + // 6/ wsa:Address - one port generated = host domain : address port / address path + // 7/ 4 + 6 - as 6 + + // TODO the binding URI will currently have been calculated during build + // however we don't give the provider a chance to get in and effect the + // calculation (see above comment). For now just fake the addition of binding + // specific processing by adding a root if it's not already present + if (!wsBinding.getURI().startsWith("http://")) { + wsBinding.setURI("http://localhost:8085" + wsBinding.getURI()); + } + System.out.println("Service URI: " + wsBinding.getURI()); + } + + public void start() { + // TODO - do we need this? + } + + public void stop() { + // TODO - do we need this? + } + + public SOAPMessage invoke(SOAPMessage request) { + try { + // Assuming document-literal-wrapper style + Node root = request.getSOAPBody().getFirstChild(); + String operationName = root.getLocalName(); + Operation operation = null; + for (InvocationChain invocationChain : endpoint.getInvocationChains()) { + if (operationName.equals(invocationChain.getSourceOperation().getName())) { + operation = invocationChain.getSourceOperation(); + break; + } + } + if (operation == null) { + throw new SOAPException("Operation not found: " + operationName); + } + + Message requestMsg = messageFactory.createMessage(); + Object[] body = new Object[]{root}; + requestMsg.setBody(body); + requestMsg.setOperation(operation); + Message responseMsg = endpoint.invoke(operation, requestMsg); + SOAPMessage response = soapMessageFactory.createMessage(); + if (responseMsg.isFault()) { + FaultException fe = responseMsg.getBody(); + SOAPFault fault = response.getSOAPBody().addFault(new QName(response.getSOAPBody().getNamespaceURI(), "Server"), "unknown"); + Detail d = fault.addDetail(); + DetailEntry de = d.addDetailEntry(fe.getFaultName()); + SOAPElement dece = de.addChildElement("message"); + if (fe.getMessage() != null) { + dece.addTextNode(fe.getMessage()); + } + } else { + Element element = responseMsg.getBody(); + response.getSOAPBody().addChildElement(soapFactory.createElement(element)); + } + return response; + } catch (SOAPException e) { + throw new ServiceRuntimeException(e); + } + } +} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingProviderFactory.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingProviderFactory.java deleted file mode 100644 index 54d1ba90a8..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingProviderFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.ws.jaxws; - -import java.util.List; - -import org.apache.tuscany.sca.binding.ws.WebServiceBinding; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; -import org.apache.tuscany.sca.provider.BindingProviderFactory; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; - -/** - * Axis2BindingProviderFactory - * - * @version $Rev$ $Date$ - */ - -public class JAXWSBindingProviderFactory implements BindingProviderFactory { - - private FactoryExtensionPoint modelFactories; - private ServletHost servletHost; - private DataBindingExtensionPoint dataBindings; - - public JAXWSBindingProviderFactory(ExtensionPointRegistry extensionPoints) { - ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); - List hosts = servletHosts.getServletHosts(); - if (!hosts.isEmpty()) { - this.servletHost = hosts.get(0); - } - modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class); - } - - public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) { - return new JAXWSReferenceBindingProvider(endpointReference, modelFactories, dataBindings); - } - - public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) { - return new JAXWSServiceBindingProvider(endpoint, servletHost, modelFactories, dataBindings); - } - - public Class getModelType() { - return WebServiceBinding.class; - } -} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSReferenceBindingProvider.java deleted file mode 100644 index 99a297e074..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSReferenceBindingProvider.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.ws.jaxws; - -import org.apache.tuscany.sca.binding.ws.WebServiceBinding; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; -import org.oasisopen.sca.ServiceRuntimeException; -import org.w3c.dom.Node; - -public class JAXWSReferenceBindingProvider implements ReferenceBindingProvider { - - private javax.xml.soap.MessageFactory messageFactory; - private WebServiceBinding wsBinding; - - public JAXWSReferenceBindingProvider(RuntimeEndpointReference endpointReference, - FactoryExtensionPoint modelFactories, - DataBindingExtensionPoint dataBindings) { - - this.messageFactory = modelFactories.getFactory(javax.xml.soap.MessageFactory.class); - this.wsBinding = (WebServiceBinding) endpointReference.getBinding(); - - // A WSDL document should always be present in the binding - if (wsBinding.getWSDLDocument() == null) { - throw new ServiceRuntimeException("No WSDL document for " + endpointReference.getURI()); - } - - // Set to use the DOM data binding - InterfaceContract contract = wsBinding.getBindingInterfaceContract(); - if (contract.getInterface() != null) { - contract.getInterface().resetDataBinding(Node.class.getName()); - } - } - - public void start() { - } - - public void stop() { - } - - public InterfaceContract getBindingInterfaceContract() { - return wsBinding.getBindingInterfaceContract(); - } - - public boolean supportsOneWayInvocation() { - return true; - } - - public Invoker createInvoker(Operation operation) { - return new JAXWSBindingInvoker(operation, null, messageFactory, wsBinding); - } - -} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java deleted file mode 100644 index 0a27eea3ce..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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.ws.jaxws; - -import javax.xml.namespace.QName; -import javax.xml.soap.Detail; -import javax.xml.soap.DetailEntry; -import javax.xml.soap.SOAPElement; -import javax.xml.soap.SOAPException; -import javax.xml.soap.SOAPFactory; -import javax.xml.soap.SOAPFault; -import javax.xml.soap.SOAPMessage; -import javax.xml.ws.Endpoint; -import javax.xml.ws.Provider; -import javax.xml.ws.ServiceMode; -import javax.xml.ws.WebServiceProvider; -import javax.xml.ws.Service.Mode; - -import org.apache.tuscany.sca.binding.ws.WebServiceBinding; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.util.FaultException; -import org.apache.tuscany.sca.invocation.InvocationChain; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -import org.oasisopen.sca.ServiceRuntimeException; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -@WebServiceProvider -@ServiceMode(Mode.MESSAGE) -public class JAXWSServiceBindingProvider implements ServiceBindingProvider, Provider { - private MessageFactory messageFactory; - private RuntimeEndpoint endpoint; - private WebServiceBinding wsBinding; - private Endpoint wsEndpoint; - private javax.xml.soap.MessageFactory soapMessageFactory; - private SOAPFactory soapFactory; - - public JAXWSServiceBindingProvider(RuntimeEndpoint endpoint, - ServletHost servletHost, - FactoryExtensionPoint modelFactories, - DataBindingExtensionPoint dataBindings) { - - this.messageFactory = modelFactories.getFactory(MessageFactory.class); - - this.soapMessageFactory = modelFactories.getFactory(javax.xml.soap.MessageFactory.class); - this.soapFactory = modelFactories.getFactory(SOAPFactory.class); - - // soapMessageFactory = javax.xml.soap.MessageFactory.newInstance(); - // soapFactory = SOAPFactory.newInstance(); - - this.endpoint = endpoint; - this.wsBinding = (WebServiceBinding)endpoint.getBinding(); - - // A WSDL document should always be present in the binding - if (wsBinding.getWSDLDocument() == null) { - throw new ServiceRuntimeException("No WSDL document for " + endpoint.getURI()); - } - - // Set to use the DOM data binding - InterfaceContract contract = wsBinding.getBindingInterfaceContract(); - contract.getInterface().resetDataBinding(Node.class.getName()); - - // Can we safely assume there is only one port because you configure - // a binding in the following ways: - // 1/ default - one port generated = host domain : host port / structural path - // 2/ uri="absolute addr" - one port generated = host domain : uri port / uri path - // 3/ uri="relative addr" - one port generated = host domain : host port / structural path / relative path - // 4/ wsdl.binding - one port generated = host domain : host port / structural path - // 5/ wsdl.port - one port generated = host domain : port port / port path - // 6/ wsa:Address - one port generated = host domain : address port / address path - // 7/ 4 + 6 - as 6 - - // TODO the binding URI will currently have been calculated during build - // however we don't give the provider a chance to get in and effect the - // calculation (see above comment). For now just fake the addition of binding - // specific processing by adding a root if it's not already present - if (!wsBinding.getURI().startsWith("http://")) { - wsBinding.setURI("http://localhost:8080" + wsBinding.getURI()); - } - System.out.println("Service URI: " + wsBinding.getURI()); - } - - public void start() { - // TODO - turn on Axis2 JAXWS support - - - wsEndpoint = Endpoint.create(this); - wsEndpoint.publish(wsBinding.getURI()); - } - - public void stop() { - wsEndpoint.stop(); - } - - public InterfaceContract getBindingInterfaceContract() { - return wsBinding.getBindingInterfaceContract(); - } - - public boolean supportsOneWayInvocation() { - return true; - } - - public SOAPMessage invoke(SOAPMessage request) { - try { - // Assuming document-literal-wrapper style - Node root = request.getSOAPBody().getFirstChild(); - String operationName = root.getLocalName(); - Operation operation = null; - for (InvocationChain invocationChain : endpoint.getInvocationChains()) { - if (operationName.equals(invocationChain.getSourceOperation().getName())) { - operation = invocationChain.getSourceOperation(); - break; - } - } - if (operation == null) { - throw new SOAPException("Operation not found: " + operationName); - } - - Message requestMsg = messageFactory.createMessage(); - Object[] body = new Object[]{root}; - requestMsg.setBody(body); - requestMsg.setOperation(operation); - Message responseMsg = endpoint.invoke(operation, requestMsg); - SOAPMessage response = soapMessageFactory.createMessage(); - if (responseMsg.isFault()) { - FaultException fe = responseMsg.getBody(); - SOAPFault fault = response.getSOAPBody().addFault(new QName(response.getSOAPBody().getNamespaceURI(), "Server"), "unknown"); - Detail d = fault.addDetail(); - DetailEntry de = d.addDetailEntry(fe.getFaultName()); - SOAPElement dece = de.addChildElement("message"); - if (fe.getMessage() != null) { - dece.addTextNode(fe.getMessage()); - } - } else { - Element element = responseMsg.getBody(); - response.getSOAPBody().addChildElement(soapFactory.createElement(element)); - } - return response; - } catch (SOAPException e) { - throw new ServiceRuntimeException(e); - } - } -} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory deleted file mode 100644 index 7b66310bba..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -# Implementation class for the binding extension -org.apache.tuscany.sca.binding.ws.jaxws.JAXWSBindingProviderFactory;model=org.apache.tuscany.sca.binding.ws.WebServiceBinding,ranking=5761 - diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java deleted file mode 100644 index 967babeae5..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ws.axis2; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.binding.ws.axis2.helloworld.HelloWorld; -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; - -public class WSDLPortTestCase extends TestCase { - - private Node node; - private HelloWorld helloWorld; - - public void testCalculator() throws Exception { - assertEquals("Hello petra", helloWorld.getGreetings("petra")); - } - - @Override - protected void setUp() throws Exception { - node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.composite", - new Contribution("test", "target/test-classes")); - node.start(); - helloWorld = node.getService(HelloWorld.class, "HelloWorldClient"); - } - - @Override - protected void tearDown() throws Exception { - node.stop(); - } - -} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java deleted file mode 100644 index 98eb6e361b..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ws.axis2.helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface HelloWorld { - - String getGreetings(String s); - -} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java deleted file mode 100644 index 2c6c4fc92c..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.ws.axis2.helloworld; - -import org.oasisopen.sca.annotation.Reference; - -public class HelloWorldClient implements HelloWorld { - - @Reference - public HelloWorld helloWorldWS; - - public String getGreetings(String s) { - String response = helloWorldWS.getGreetings(s); - System.out.println("At client: " + response); - return response; - } - -} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java deleted file mode 100644 index 3662007984..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ws.axis2.helloworld; - -public class HelloWorldService implements HelloWorld { - - public String getGreetings(String s) { - String response = "Hello " + s; - System.out.println("At service: " + response); - return response; - } - -} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.composite b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.composite deleted file mode 100644 index a4d63d2333..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.composite +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.wsdl b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.wsdl deleted file mode 100644 index c5b59f1462..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.wsdl +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3