diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-21 07:55:20 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-21 07:55:20 +0000 |
commit | 36436b71b9977d6b5940cb6285d5335708ef9bfa (patch) | |
tree | b218a104f180c67690a6ae2ad097cd9306a8f203 /sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src | |
parent | d5be76c0b31df9b5d203295b146b13d2205243de (diff) |
Moving 1.x tags
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@882851 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src')
37 files changed, 3257 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/WebServiceAssemblyFactory.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/WebServiceAssemblyFactory.java new file mode 100644 index 0000000000..5d8f286944 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/WebServiceAssemblyFactory.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly; + +import org.apache.tuscany.model.assembly.AssemblyFactory; + +/** + * The <b>Factory</b> for the model. + */ +public interface WebServiceAssemblyFactory extends AssemblyFactory { + + /** + * Returns a new WebServiceBinding. + */ + WebServiceBinding createWebServiceBinding(); + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/WebServiceBinding.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/WebServiceBinding.java new file mode 100644 index 0000000000..3c223ffa8e --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/WebServiceBinding.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly; + +import javax.wsdl.Definition; +import javax.wsdl.Port; + +import org.apache.tuscany.model.assembly.Binding; + +/** + * Represents a Web service binding. + */ +public interface WebServiceBinding extends Binding { + + /** + * Returns the WSDL port defining this binding. + */ + Port getWSDLPort(); + + /** + * Returns the WSDL definition containing the WSDL port. + * @return + */ + Definition getWSDLDefinition(); + + /** + * Sets the WSDL port defining this binding. + */ + void setWSDLPort(Port value); + + /** + * Sets the WSDL definition containing the WSDL port. + * @param definition + */ + void setWSDLDefinition(Definition definition); + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/impl/WebServiceAssemblyFactoryImpl.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/impl/WebServiceAssemblyFactoryImpl.java new file mode 100644 index 0000000000..4a3154f2c1 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/impl/WebServiceAssemblyFactoryImpl.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.impl; + +import org.apache.tuscany.binding.axis.assembly.WebServiceAssemblyFactory; +import org.apache.tuscany.binding.axis.assembly.WebServiceBinding; +import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; + +/** + * An implementation of the model <b>Factory</b>. + */ +public class WebServiceAssemblyFactoryImpl extends AssemblyFactoryImpl implements WebServiceAssemblyFactory { + + /** + * Creates an instance of the factory. + */ + public WebServiceAssemblyFactoryImpl() { + super(); + } + + /** + * @see org.apache.tuscany.binding.axis.assembly.WebServiceAssemblyFactory#createWebServiceBinding() + */ + public WebServiceBinding createWebServiceBinding() { + return new WebServiceBindingImpl(); + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/impl/WebServiceBindingImpl.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/impl/WebServiceBindingImpl.java new file mode 100644 index 0000000000..37ed0191e6 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/assembly/impl/WebServiceBindingImpl.java @@ -0,0 +1,116 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.impl; + +import java.util.Collection; +import java.util.List; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; + +import org.apache.tuscany.binding.axis.assembly.WebServiceBinding; +import org.apache.tuscany.model.assembly.AssemblyModelContext; +import org.apache.tuscany.model.assembly.impl.BindingImpl; + +/** + * An implementation of WebServiceBinding. + */ +public class WebServiceBindingImpl extends BindingImpl implements WebServiceBinding { + + private Definition definition; + private Port port; + private String portURI; + + /** + * Constructor + */ + protected WebServiceBindingImpl() { + } + + /** + * @see org.apache.tuscany.binding.axis.assembly.WebServiceBinding#getWSDLPort() + */ + public Port getWSDLPort() { + return port; + } + + /** + * @see org.apache.tuscany.binding.axis.assembly.WebServiceBinding#setWSDLPort(javax.wsdl.Port) + */ + public void setWSDLPort(Port value) { + checkNotFrozen(); + this.port=value; + } + + /** + * @see org.apache.tuscany.binding.axis.assembly.WebServiceBinding#getWSDLDefinition() + */ + public Definition getWSDLDefinition() { + return definition; + } + + /** + * @see org.apache.tuscany.binding.axis.assembly.WebServiceBinding#setWSDLDefinition(javax.wsdl.Definition) + */ + public void setWSDLDefinition(Definition definition) { + checkNotFrozen(); + this.definition=definition; + } + + /** + * @param portURI The portURI to set. + */ + public void setPortURI(String portURI) { + this.portURI = portURI; + } + + /** + * @see org.apache.tuscany.model.assembly.impl.BindingImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) + */ + public void initialize(AssemblyModelContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Get the WSDL port namespace and name + if (port==null && portURI!=null) { + int h=portURI.indexOf('#'); + String portNamespace=portURI.substring(0,h); + String portName=portURI.substring(h+1); + + // Load the WSDL definitions for the given namespace + List<Definition> definitions=modelContext.getAssemblyLoader().loadDefinitions(portNamespace); + if (definitions==null) + throw new IllegalArgumentException("Cannot find WSDL definition for "+portNamespace); + for (Definition definition: definitions) { + + // Find the port with the given name + for (Service service : (Collection<Service>)definition.getServices().values()) { + Port port=service.getPort(portName); + if (port!=null) { + this.definition=definition; + this.port=port; + return; + } + } + } + throw new IllegalArgumentException("Cannot find WSDL port "+portURI); + } + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceConfigurationBuilder.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceConfigurationBuilder.java new file mode 100644 index 0000000000..c9c87e1e11 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceConfigurationBuilder.java @@ -0,0 +1,150 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.builder; + +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +import org.apache.tuscany.binding.axis.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis.config.ExternalWebServiceRuntimeConfiguration; +import org.apache.tuscany.binding.axis.handler.ExternalWebServiceClient; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.core.invocation.InvocationConfiguration; +import org.apache.tuscany.core.invocation.MethodHashMap; +import org.apache.tuscany.core.invocation.ProxyConfiguration; +import org.apache.tuscany.core.invocation.impl.InvokerInterceptor; +import org.apache.tuscany.core.invocation.spi.ProxyFactory; +import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.model.assembly.AssemblyModelObject; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +/** + * Creates a <code>RuntimeConfigurationBuilder</code> for an external service configured with the {@link WebServiceBinding} + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ExternalWebServiceConfigurationBuilder implements RuntimeConfigurationBuilder { + + private RuntimeContext runtimeContext; + + private ProxyFactoryFactory proxyFactoryFactory; + + private MessageFactory messageFactory; + + private RuntimeConfigurationBuilder policyBuilder; + + public ExternalWebServiceConfigurationBuilder() { + } + + @Init(eager = true) + public void init() { + runtimeContext.addBuilder(this); + } + + /** + * @param runtimeContext The runtimeContext to set. + */ + @Autowire + public void setRuntimeContext(RuntimeContext runtimeContext) { + this.runtimeContext = runtimeContext; + } + + /** + * Sets the factory used to construct proxies implmementing the business interface required by a reference + */ + @Autowire + public void setProxyFactoryFactory(ProxyFactoryFactory factory) { + this.proxyFactoryFactory = factory; + } + + /** + * Sets the factory used to construct invocation messages + * + * @param msgFactory + */ + @Autowire + public void setMessageFactory(MessageFactory msgFactory) { + this.messageFactory = msgFactory; + } + + /** + * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The + * reference builder may be hierarchical, containing other child reference builders that operate on specific + * metadata used to construct and invocation chain. + * + * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder + */ + public void setPolicyBuilder(RuntimeConfigurationBuilder builder) { + policyBuilder = builder; + } + + public void build(AssemblyModelObject object, Context context) throws BuilderException { + if (!(object instanceof ExternalService)) { + return; + } + ExternalService externalService = (ExternalService) object; + if (externalService.getBindings().size() < 1 || !(externalService.getBindings().get(0) instanceof WebServiceBinding)) { + return; + } + + WebServiceBinding wsBinding=(WebServiceBinding)externalService.getBindings().get(0); + + ExternalWebServiceClient externalWebServiceClient=new ExternalWebServiceClient(externalService, wsBinding); + ExternalWebServiceRuntimeConfiguration config = new ExternalWebServiceRuntimeConfiguration(externalService.getName(), new SingletonObjectFactory<ExternalWebServiceClient>(externalWebServiceClient)); + + ConfiguredService configuredService = externalService.getConfiguredService(); + Service service = configuredService.getService(); + ServiceContract serviceContract = service.getServiceContract(); + Map<Method, InvocationConfiguration> iConfigMap = new MethodHashMap(); + ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory(); + Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface()); + for (Method method : javaMethods) { + InvocationConfiguration iConfig = new InvocationConfiguration(method); + iConfigMap.put(method, iConfig); + } + QualifiedName qName = new QualifiedName(externalService.getName() + QualifiedName.NAME_SEPARATOR + service.getName()); + ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory); + proxyFactory.setBusinessInterface(serviceContract.getInterface()); + proxyFactory.setProxyConfiguration(pConfiguration); + config.addTargetProxyFactory(service.getName(), proxyFactory); + configuredService.setProxyFactory(proxyFactory); + if (policyBuilder != null) { + // invoke the reference builder to handle additional policy metadata + policyBuilder.build(configuredService, context); + } + // add tail interceptor + for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) { + iConfig.addTargetInterceptor(new InvokerInterceptor()); + } + + externalService.getConfiguredService().setRuntimeConfiguration(config); + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceWireBuilder.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceWireBuilder.java new file mode 100644 index 0000000000..e006b0e4ff --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceWireBuilder.java @@ -0,0 +1,61 @@ +package org.apache.tuscany.binding.axis.builder; + +import org.apache.tuscany.binding.axis.config.ExternalWebServiceRuntimeConfiguration; +import org.apache.tuscany.binding.axis.handler.ExternalWebServiceTargetInvoker; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.invocation.InvocationConfiguration; +import org.apache.tuscany.core.invocation.spi.ProxyFactory; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +@Scope("MODULE") +public class ExternalWebServiceWireBuilder implements WireBuilder { + + private RuntimeContext runtimeContext; + + /** + * Constructs a new ExternalWebServiceWireBuilder. + */ + public ExternalWebServiceWireBuilder() { + super(); + } + + @Autowire + public void setRuntimeContext(RuntimeContext context) { + runtimeContext = context; + } + + @Init(eager=true) + public void init() { + runtimeContext.addBuilder(this); + } + + public void connect(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope, ScopeContext targetScopeContext) throws BuilderConfigException { + if (!(ExternalWebServiceRuntimeConfiguration.class.isAssignableFrom(targetType))) { + return; + } + for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations().values()) { + + ExternalWebServiceTargetInvoker invoker = new ExternalWebServiceTargetInvoker(sourceFactory.getProxyConfiguration().getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext); + + // if (downScope) { + // // the source scope is shorter than the target, so the invoker can cache the target instance + // invoker.setCacheable(true); + // } else { + // invoker.setCacheable(false); + // } + sourceInvocationConfig.setTargetInvoker(invoker); + } + + } + + public void completeTargetChain(ProxyFactory targetFactory, Class targetType, ScopeContext targetScopeContext) + throws BuilderConfigException { + //TODO implement + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/WebServiceEntryPointConfigurationBuilder.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/WebServiceEntryPointConfigurationBuilder.java new file mode 100644 index 0000000000..ac4b8b16eb --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/WebServiceEntryPointConfigurationBuilder.java @@ -0,0 +1,170 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.builder; + +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.apache.tuscany.binding.axis.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis.config.WebServiceEntryPointRuntimeConfiguration; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder; +import org.apache.tuscany.core.builder.impl.EntryPointRuntimeConfiguration; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.context.AggregateContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.invocation.Interceptor; +import org.apache.tuscany.core.invocation.InvocationConfiguration; +import org.apache.tuscany.core.invocation.InvocationRuntimeException; +import org.apache.tuscany.core.invocation.ProxyConfiguration; +import org.apache.tuscany.core.invocation.TargetInvoker; +import org.apache.tuscany.core.invocation.spi.ProxyFactory; +import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.model.assembly.AssemblyModelObject; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +/** + * Creates a <code>RuntimeConfigurationBuilder</code> for an entry point configured with the {@link WebServiceBinding} + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class WebServiceEntryPointConfigurationBuilder implements RuntimeConfigurationBuilder<AggregateContext> { + + private RuntimeContext runtimeContext; + + private ProxyFactoryFactory proxyFactoryFactory; + + private MessageFactory messageFactory; + + private RuntimeConfigurationBuilder policyBuilder; + + public WebServiceEntryPointConfigurationBuilder() { + } + + @Init(eager = true) + public void init() { + runtimeContext.addBuilder(this); + } + + /** + * @param runtimeContext The runtimeContext to set. + */ + @Autowire + public void setRuntimeContext(RuntimeContext runtimeContext) { + this.runtimeContext = runtimeContext; + } + + /** + * Sets the factory used to construct proxies implmementing the business interface required by a reference + */ + @Autowire + public void setProxyFactoryFactory(ProxyFactoryFactory factory) { + this.proxyFactoryFactory = factory; + } + + /** + * Sets the factory used to construct invocation messages + * + * @param msgFactory + */ + @Autowire + public void setMessageFactory(MessageFactory msgFactory) { + this.messageFactory = msgFactory; + } + + /** + * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The + * reference builder may be hierarchical, containing other child reference builders that operate on specific + * metadata used to construct and invocation chain. + * + * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder + */ + public void setPolicyBuilder(RuntimeConfigurationBuilder builder) { + policyBuilder = builder; + } + + public void build(AssemblyModelObject object, AggregateContext parentContext) throws BuilderException { + if (!(object instanceof EntryPoint)) { + return; + } + EntryPoint entryPoint = (EntryPoint) object; + if (entryPoint.getBindings().size() < 1 || !(entryPoint.getBindings().get(0) instanceof WebServiceBinding)) { + return; + } + + EntryPointRuntimeConfiguration config = new WebServiceEntryPointRuntimeConfiguration(entryPoint.getName(), entryPoint.getConfiguredService().getService().getName(), messageFactory); + + ConfiguredService configuredService = entryPoint.getConfiguredService(); + Service service = configuredService.getService(); + ServiceContract serviceContract = service.getServiceContract(); + Map<Method, InvocationConfiguration> iConfigMap = new HashMap(); + ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory(); + Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface()); + for (Method method : javaMethods) { + InvocationConfiguration iConfig = new InvocationConfiguration(method); + iConfigMap.put(method, iConfig); + } + QualifiedName qName = new QualifiedName(entryPoint.getConfiguredReference().getTargetConfiguredServices().get(0).getAggregatePart().getName() + QualifiedName.NAME_SEPARATOR + service.getName()); + ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory); + proxyFactory.setBusinessInterface(serviceContract.getInterface()); + proxyFactory.setProxyConfiguration(pConfiguration); + config.addSourceProxyFactory(service.getName(), proxyFactory); + configuredService.setProxyFactory(proxyFactory); + if (policyBuilder != null) { + // invoke the reference builder to handle additional policy metadata + policyBuilder.build(configuredService, parentContext); + } + // add tail interceptor + for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) { + iConfig.addTargetInterceptor(new EntryPointInvokerInterceptor()); + } + entryPoint.getConfiguredReference().setRuntimeConfiguration(config); + } + + //FIXME same as the InvokerInterceptor except that it doesn't throw an exception in setNext + // For some reason another InvokerInterceptor is added after this one, need Jim to look into it + // and figure out why. + public class EntryPointInvokerInterceptor implements Interceptor { + + public EntryPointInvokerInterceptor() { + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + TargetInvoker invoker = msg.getTargetInvoker(); + if (invoker == null) { + throw new InvocationRuntimeException("No target invoker specified on message"); + } + return invoker.invoke(msg); + } + + public void setNext(Interceptor next) { + } + + } + + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java new file mode 100644 index 0000000000..c3145137dd --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.config; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.builder.impl.BaseExternalServiceRuntimeConfiguration; + +/** + * Creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} configured with the appropriate + * invocation chains and bindings. This implementation serves as a marker for + * {@link org.apache.tuscany.binding.axis.builder.ExternalWebServiceWireBuilder} + * + * @version $Rev$ $Date$ + */ +public class ExternalWebServiceRuntimeConfiguration extends BaseExternalServiceRuntimeConfiguration { + + public ExternalWebServiceRuntimeConfiguration(String name, ObjectFactory objectFactory) { + super(name, objectFactory); + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/WebServiceEntryPointRuntimeConfiguration.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/WebServiceEntryPointRuntimeConfiguration.java new file mode 100644 index 0000000000..37fbd325e5 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/WebServiceEntryPointRuntimeConfiguration.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.config; + +import org.apache.tuscany.core.builder.impl.EntryPointRuntimeConfiguration; +import org.apache.tuscany.core.message.MessageFactory; + +/** + * Creates instances of {@link org.apache.tuscany.core.context.EntryPointContext} configured with the appropriate + * invocation chains and bindings. This implementation serves as a marker for + * {@link org.apache.tuscany.binding.axis.builder.WebServiceEntryPointWireBuilder} + * + * @version $Rev$ $Date$ + */ +public class WebServiceEntryPointRuntimeConfiguration extends EntryPointRuntimeConfiguration { + + public WebServiceEntryPointRuntimeConfiguration(String name, String serviceName, MessageFactory messageFactory) { + super(name, serviceName, messageFactory); + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java new file mode 100644 index 0000000000..a14f3de037 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java @@ -0,0 +1,265 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.engine.config; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.servlet.ServletConfig; +import javax.wsdl.Definition; +import javax.wsdl.Operation; +import javax.wsdl.Port; +import javax.wsdl.PortType; +import javax.xml.namespace.QName; +import javax.xml.rpc.Service; +import javax.xml.rpc.ServiceException; +import javax.xml.rpc.ServiceFactory; + +import org.apache.axis.EngineConfiguration; +import org.apache.axis.EngineConfigurationFactory; +import org.apache.axis.MessageContext; +import org.apache.axis.configuration.FileProvider; +import org.apache.axis.configuration.SimpleProvider; +import org.apache.axis.constants.Style; +import org.apache.axis.constants.Use; +import org.apache.axis.description.JavaServiceDesc; +import org.apache.axis.description.OperationDesc; +import org.apache.axis.description.ParameterDesc; +import org.apache.axis.handlers.soap.SOAPService; +import org.apache.axis.providers.java.RPCProvider; +import org.apache.tuscany.binding.axis.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis.handler.WebServicePortMetaData; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.context.AggregateContext; +import org.apache.tuscany.core.context.webapp.TuscanyWebAppRuntime; +import org.apache.tuscany.core.invocation.spi.ProxyFactory; +import org.apache.tuscany.model.assembly.AssemblyModelContext; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Module; +import org.osoa.sca.ServiceRuntimeException; +import org.osoa.sca.ServiceUnavailableException; + +/** + */ +public class AxisEngineConfigurationFactory implements EngineConfigurationFactory { + + private TuscanyWebAppRuntime tuscanyRuntime; + + /** + * Constructor + * + */ + public AxisEngineConfigurationFactory(TuscanyWebAppRuntime tuscanyRuntime) { + this.tuscanyRuntime = tuscanyRuntime; + } + + /** + * Creates a new factory. + * + * @see org.apache.axis.configuration.EngineConfigurationFactoryFinder + */ + public static EngineConfigurationFactory newFactory(Object param) { + if (param instanceof ServletConfig) { + + // Only configure Tuscany apps + // Get the Tuscany runtime out of the servlet context + TuscanyWebAppRuntime tuscanyRuntime = (TuscanyWebAppRuntime) ((ServletConfig) param).getServletContext().getAttribute(TuscanyWebAppRuntime.class.getName()); + if (tuscanyRuntime == null) + return null; + + return new AxisEngineConfigurationFactory(tuscanyRuntime); + } else { + return null; + } + } + + /** + * @see org.apache.axis.EngineConfigurationFactory#getClientEngineConfig() + */ + public EngineConfiguration getClientEngineConfig() { + + // Used only on the server side + return null; + } + + /** + * @see org.apache.axis.EngineConfigurationFactory#getServerEngineConfig() + */ + public EngineConfiguration getServerEngineConfig() { + + // Get the current SCA module context + AggregateContext moduleContext = tuscanyRuntime.getModuleComponentContext(); + tuscanyRuntime.start(); + try { + + Module module = (Module)moduleContext.getAggregate(); + AssemblyModelContext modelContext = module.getAssemblyModelContext(); + + // Load the .wsdd configuration + ResourceLoader bundleContext = modelContext.getApplicationResourceLoader(); + InputStream wsdd; + try { + URL url = bundleContext.getResource("org/apache/tuscany/binding/axis/engine/config/server-config.wsdd"); + wsdd = url.openStream(); + } catch (IOException e1) { + throw new ServiceRuntimeException(e1); + } + FileProvider wsddConfigurationProvider = new FileProvider(wsdd); + + // Create our dynamic configuration + SimpleProvider dynamicConfigurationProvider = new SimpleProvider(wsddConfigurationProvider); + + // Register all the Web service entry points + for (Iterator i = module.getEntryPoints().iterator(); i.hasNext();) { + EntryPoint entryPoint = (EntryPoint) i.next(); + Binding binding = (Binding) entryPoint.getBindings().get(0); + if (binding instanceof WebServiceBinding) { + //FIXME This should not use the proxy factory - use EntryPointContext#getInstance() + // Get the proxy factory associated with the entry point + final ProxyFactory proxyFactory=(ProxyFactory)entryPoint.getConfiguredService().getProxyFactory(); + + // Create a new SOAP service + SOAPService service = new SOAPService(new RPCProvider() { + protected Object makeNewServiceObject(MessageContext arg0, String arg1) throws Exception { + + // The SOAP service will delegate to a dynamic proxy + return proxyFactory.createProxy(); + } + }); + + // Get the WSDL definition and port + WebServiceBinding wsBinding = (WebServiceBinding) binding; + Definition definition=wsBinding.getWSDLDefinition(); + Port port=wsBinding.getWSDLPort(); + WebServicePortMetaData wsPortMetaData = new WebServicePortMetaData(definition, port, null, false); + + // Configure the SOAP service + service.setOption(RPCProvider.OPTION_WSDL_TARGETNAMESPACE, wsPortMetaData.getPortName().getNamespaceURI()); + service.setOption(RPCProvider.OPTION_WSDL_SERVICEELEMENT, wsPortMetaData.getServiceName().getLocalPart()); + service.setOption(RPCProvider.OPTION_WSDL_SERVICEPORT, wsPortMetaData.getPortName().getLocalPart()); + service.setOption(RPCProvider.OPTION_WSDL_PORTTYPE, wsPortMetaData.getPortTypeName().getLocalPart()); + //FIXME RPCProvider is not happy if you don't give it a class name... + service.setOption(RPCProvider.OPTION_CLASSNAME, Object.class.getName()); + + // Create a service description + JavaServiceDesc serviceDesc = (JavaServiceDesc) service.getServiceDescription(); + serviceDesc.setName(entryPoint.getName()); + String wsdlFile = definition.getDocumentBaseURI(); + if (wsdlFile.startsWith("file:")) + wsdlFile = wsdlFile.substring(5); + serviceDesc.setWSDLFile(wsdlFile); + serviceDesc.setDefaultNamespace(wsPortMetaData.getPortName().getNamespaceURI()); + serviceDesc.setStyle(Style.DOCUMENT); + serviceDesc.setUse(Use.LITERAL); + + // Get the service interface + Class serviceInterface=entryPoint.getConfiguredService().getService().getServiceContract().getInterface(); + Set methods=JavaIntrospectionHelper.getAllUniqueMethods(serviceInterface); + serviceDesc.setAllowedMethods(new ArrayList(methods)); + + // Create a JAX-RPC service + QName wsdlServiceName = wsPortMetaData.getService().getQName(); + Service jaxrpcService; + try { + URL url=new URL(wsBinding.getWSDLDefinition().getDocumentBaseURI()); + jaxrpcService = ServiceFactory.newInstance().createService(url, wsdlServiceName); + } catch (ServiceException e) { + throw new ServiceUnavailableException(e); + } catch (MalformedURLException e) { + throw new ServiceUnavailableException(e); + } + + // Create operation descriptions for all the operations + PortType wsdlPortType = wsPortMetaData.getPortType(); + for (Iterator j = wsdlPortType.getOperations().iterator(); j.hasNext();) { + Operation wsdlOperation = (Operation) j.next(); + String operationName = wsdlOperation.getName(); + + // Create a JAX RPC call object + QName portName = wsPortMetaData.getPortName(); + org.apache.axis.client.Call call; + try { + call = (org.apache.axis.client.Call) jaxrpcService.createCall(portName, operationName); + } catch (ServiceException e) { + throw new IllegalArgumentException(e); + } + + OperationDesc operationDesc = call.getOperation(); + operationDesc.setName(operationName); + List<Class> argTypes=new ArrayList<Class>(); + for (ParameterDesc parameterDesc : (List<ParameterDesc>)operationDesc.getAllInParams()) { + argTypes.add(parameterDesc.getJavaType()); + } + Method method=JavaIntrospectionHelper.findClosestMatchingMethod(operationName, argTypes.toArray(new Class[argTypes.size()]), methods); + operationDesc.setMethod(method); + +// OperationDesc operationDesc = new OperationDesc(); +// operationDesc.setName(operationName); +// Method method=JavaIntrospectionHelper.findClosestMatchingMethod(operationName, new Class[]{String.class}, methods); +// operationDesc.setMethod(method); +// +// WebServiceOperationMetaData wsOperationMetaData = wsPortMetaData.getOperationMetaData(operationName); +// String soapAction = wsOperationMetaData.getSOAPAction(); +// if (soapAction != null && soapAction.length()!=0) +// operationDesc.setSoapAction(soapAction); +// +// operationDesc.setElementQName((QName) wsOperationMetaData.getOperationSignature().get(0)); +// +// Message inputMessage=wsdlOperation.getInput()!=null? wsdlOperation.getInput().getMessage():null; +// if (inputMessage!=null & !inputMessage.getParts().isEmpty()) { +// ParameterDesc parameterDesc = new ParameterDesc(); +// QName anyQName = new QName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "any"); +// parameterDesc.setTypeQName(anyQName); +// parameterDesc.setQName(anyQName); +// parameterDesc.setJavaType(Object.class); +// operationDesc.addParameter(parameterDesc); +// } +// +// Message outputMessage=wsdlOperation.getOutput()!=null? wsdlOperation.getOutput().getMessage():null; +// if (outputMessage!=null & !outputMessage.getParts().isEmpty()) { +// QName anyQName = new QName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "any"); +// operationDesc.setReturnType(anyQName); +// operationDesc.setReturnQName(anyQName); +// operationDesc.setReturnClass(Object.class); +// } + + serviceDesc.addOperationDesc(operationDesc); + } + + // Deploy the service + dynamicConfigurationProvider.deployService(entryPoint.getName(), service); + + } + } + return dynamicConfigurationProvider; + + } finally { + tuscanyRuntime.stop(); + } + + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceClient.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceClient.java new file mode 100644 index 0000000000..9d024bb036 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceClient.java @@ -0,0 +1,119 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.handler; + +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.rmi.RemoteException; +import java.util.Map; +import java.util.Set; + +import javax.xml.namespace.QName; +import javax.xml.rpc.Call; +import javax.xml.rpc.Service; +import javax.xml.rpc.ServiceException; +import javax.xml.rpc.ServiceFactory; + +import org.apache.tuscany.binding.axis.assembly.WebServiceBinding; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.invocation.MethodHashMap; +import org.apache.tuscany.model.assembly.ExternalService; +import org.osoa.sca.ServiceRuntimeException; +import org.osoa.sca.ServiceUnavailableException; + +/** + * A mock client for a transport binding + * + * @version $Rev$ $Date$ + */ +public class ExternalWebServiceClient { + + + private WebServicePortMetaData wsPortMetaData; + private Service jaxrpcService; + private Map<Method, Call> jaxrpcCalls=new MethodHashMap(); + + /** + * Constructs a new ExternalWebServiceClient. + * @param externalService + * @param wsBinding + */ + public ExternalWebServiceClient(ExternalService externalService, WebServiceBinding wsBinding) { + + // Create a port metadata info object to hold the port information + wsPortMetaData = new WebServicePortMetaData(wsBinding.getWSDLDefinition(), wsBinding.getWSDLPort(), wsBinding.getURI(), false); + + // Create a JAX-RPC service + QName wsdlServiceName = wsPortMetaData.getService().getQName(); + try { + URL url=new URL(wsBinding.getWSDLDefinition().getDocumentBaseURI()); + jaxrpcService = ServiceFactory.newInstance().createService(url, wsdlServiceName); + } catch (ServiceException e) { + throw new ServiceUnavailableException(e); + } catch (MalformedURLException e) { + throw new ServiceUnavailableException(e); + } + + // Create JAX-RPC calls for all the methods on the service contract + Set<Method> methods=JavaIntrospectionHelper.getAllUniqueMethods(externalService.getConfiguredService().getService().getServiceContract().getInterface()); + for (Method method : methods) { + Call call=createCall(method); + jaxrpcCalls.put(method, call); + } + + } + + /** + * Create a JAX-RPC call for the given method. + * @param method + * @return + */ + private Call createCall(Method method) { + + // Create a JAX RPC call object + QName portName = wsPortMetaData.getPortName(); + Call call; + try { + call = (Call) jaxrpcService.createCall(portName, method.getName()); + } catch (ServiceException e) { + throw new IllegalArgumentException(e); + } + + // Set the target endpoint address + String endpoint = wsPortMetaData.getEndpoint(); + if (endpoint != null) { + String originalEndpoint = call.getTargetEndpointAddress(); + if (!endpoint.equals(originalEndpoint)) + call.setTargetEndpointAddress(endpoint); + } + + return call; + } + + /** + * Invoke an operation on the external Web service. + * @param method + * @param args + * @return + */ + public Object invoke(Method method, Object[] args) { + Call call=jaxrpcCalls.get(method); + try { + return call.invoke(args); + } catch (RemoteException e) { + throw new ServiceRuntimeException(e); + } + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceTargetInvoker.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceTargetInvoker.java new file mode 100644 index 0000000000..64f33a1829 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/ExternalWebServiceTargetInvoker.java @@ -0,0 +1,109 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.handler; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.context.ExternalServiceContext; +import org.apache.tuscany.core.context.InstanceContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.invocation.Interceptor; +import org.apache.tuscany.core.invocation.TargetInvoker; +import org.apache.tuscany.core.message.Message; + +/** + * Responsible for invoking an external web service + * + * @version $Rev$ $Date$ + */ +public class ExternalWebServiceTargetInvoker implements TargetInvoker { + + private QualifiedName serviceName; + private String esName; + private Method method; + private ScopeContext container; + + private ExternalServiceContext context; + + /** + * Constructs a new ExternalWebServiceTargetInvoker. + * @param esName + * @param container + */ + public ExternalWebServiceTargetInvoker(QualifiedName serviceName, Method method, ScopeContext container) { + assert (serviceName != null) : "No service name specified"; + assert (method != null) : "No method specified"; + assert (container != null) : "No scope container specified"; + this.serviceName = serviceName; + this.esName=serviceName.getPartName(); + this.method = method; + this.container = container; + } + + public Object invokeTarget(Object payload) throws InvocationTargetException { + if (context == null) { + InstanceContext iContext = container.getContext(esName); + if (!(iContext instanceof ExternalServiceContext)) { + TargetException te = new TargetException("Unexpected target context type"); + te.setIdentifier(iContext.getClass().getName()); + te.addContextName(iContext.getName()); + throw te; + } + context = (ExternalServiceContext) iContext; + } + ExternalWebServiceClient client = (ExternalWebServiceClient) context.getImplementationInstance(true); + if (payload != null) { + return client.invoke(method, (Object[])payload); + } else { + return client.invoke(method, null); + } + } + + public boolean isCacheable() { + return false; + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg.getBody()); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBody(e.getCause()); + } catch (Throwable e) { + msg.setBody(e); + } + return msg; + } + + public void setNext(Interceptor next) { + throw new UnsupportedOperationException(); + } + + public Object clone() { + try { + ExternalWebServiceTargetInvoker invoker = (ExternalWebServiceTargetInvoker) super.clone(); + invoker.container = container; + invoker.context = this.context; + invoker.esName = this.esName; + invoker.method = this.method; + invoker.serviceName = this.serviceName; + return invoker; + } catch (CloneNotSupportedException e) { + return null; // will not happen + } + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointServlet.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointServlet.java new file mode 100644 index 0000000000..d3773ca415 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointServlet.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.handler; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.axis.AxisEngine; +import org.apache.axis.AxisFault; +import org.apache.axis.EngineConfiguration; +import org.apache.axis.server.AxisServer; +import org.apache.axis.transport.http.AxisServlet; + +import org.apache.tuscany.binding.axis.engine.config.AxisEngineConfigurationFactory; +import org.apache.tuscany.core.context.webapp.TuscanyWebAppRuntime; + +/** + */ +public class WebServiceEntryPointServlet extends AxisServlet { + + /** + * + */ + public WebServiceEntryPointServlet() { + super(); + } + + /** + * @see org.apache.axis.transport.http.AxisServletBase#getEngine() + */ + public AxisServer getEngine() throws AxisFault { + AxisServer engine = null; + ServletContext context = getServletContext(); + synchronized (context) { + engine = (AxisServer) getServletContext().getAttribute(getServletName() + ".WebServiceEntryPointAxisEngine"); + if (engine == null) { + Map environment = new HashMap(); + environment.put(AxisEngine.ENV_SERVLET_CONTEXT, context); + String webInfPath = context.getRealPath("/WEB-INF"); + if (webInfPath != null) + environment.put(AxisEngine.ENV_SERVLET_REALPATH, webInfPath + File.separator + "attachments"); + TuscanyWebAppRuntime tuscanyRuntime = (TuscanyWebAppRuntime) context.getAttribute(TuscanyWebAppRuntime.class.getName()); + EngineConfiguration config = new AxisEngineConfigurationFactory(tuscanyRuntime).getServerEngineConfig(); + if (config != null) { + environment.put(EngineConfiguration.PROPERTY_NAME, config); + } + engine = AxisServer.getServer(environment); + engine.setName(getServletName()); + context.setAttribute(getServletName() + ".WebServiceEntryPointAxisEngine", engine); + } + } + return engine; + } + + /** + * @see org.apache.axis.transport.http.AxisServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + public void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException { + super.doPost(arg0, arg1); + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceOperationMetaData.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceOperationMetaData.java new file mode 100644 index 0000000000..99aa62f78f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceOperationMetaData.java @@ -0,0 +1,484 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.handler; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import javax.wsdl.Binding; +import javax.wsdl.BindingInput; +import javax.wsdl.BindingOperation; +import javax.wsdl.BindingOutput; +import javax.wsdl.Input; +import javax.wsdl.Message; +import javax.wsdl.Operation; +import javax.wsdl.Output; +import javax.wsdl.Part; +import javax.wsdl.extensions.soap.SOAPBinding; +import javax.wsdl.extensions.soap.SOAPHeader; +import javax.wsdl.extensions.soap.SOAPOperation; +import javax.xml.namespace.QName; + +/** + * Metadata for a WSDL operation + * + */ +public class WebServiceOperationMetaData { + // WSDL Binding and BindingOperation + private Binding binding; + private BindingOperation bindingOperation; + + // Fields to cache derived metadata + private transient Set inputHeaderParts; + private transient Set outputHeaderParts; + private transient String style; + private transient String use; + private transient String soapAction; + private transient List signature; + private String encoding; + private transient QName rpcOperationName; + + public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation) { + this.binding = binding; + this.bindingOperation = bindingOperation; + } + + public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation, String style, String use, String encoding, String soapAction) { + this.binding = binding; + this.bindingOperation = bindingOperation; + this.style = style; + this.use = use; + this.encoding = encoding; + this.soapAction = soapAction; + } + + public Set getInputHeaderParts() { + if (inputHeaderParts == null) { + // Build a set of header parts that we need to exclude + inputHeaderParts = new HashSet(); + BindingInput bindingInput = bindingOperation.getBindingInput(); + + if (bindingInput != null) { + Operation operation = bindingOperation.getOperation(); + javax.wsdl.Message message = operation.getInput().getMessage(); + List elements = bindingInput.getExtensibilityElements(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object extensibilityElement = i.next(); + Part part = getPartFromSOAPHeader(message, extensibilityElement); + if (part != null) { + inputHeaderParts.add(part); + } + } + } + } + return inputHeaderParts; + } + + public Set getOutputHeaderParts() { + if (outputHeaderParts == null) { + // Build a set of header parts that we need to exclude + outputHeaderParts = new HashSet(); + BindingOutput bindingOutput = bindingOperation.getBindingOutput(); + + if (bindingOutput != null) { + Operation operation = bindingOperation.getOperation(); + javax.wsdl.Message message = operation.getOutput().getMessage(); + List elements = bindingOutput.getExtensibilityElements(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object extensibilityElement = i.next(); + Part part = getPartFromSOAPHeader(message, extensibilityElement); + if (part != null) { + outputHeaderParts.add(part); + } + } + } + } + return outputHeaderParts; + } + + private Part getPartFromSOAPHeader(Message message, Object extensibilityElement) { + Part part = null; + if (extensibilityElement instanceof SOAPHeader) { + SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; + QName msgName = soapHeader.getMessage(); + if (message.getQName().equals(msgName)) { + part = message.getPart(soapHeader.getPart()); + } + } else if (extensibilityElement instanceof SOAPHeader) { + SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; + QName msgName = soapHeader.getMessage(); + if (message.getQName().equals(msgName)) { + part = message.getPart(soapHeader.getPart()); + } + } + return part; + } + + public String getStyle() { + if (style == null) { + SOAPOperation soapOperation = (SOAPOperation) WebServicePortMetaData.getExtensibilityElement(bindingOperation.getExtensibilityElements(), SOAPOperation.class); + if (soapOperation != null) + style = soapOperation.getStyle(); + if (style == null) { + SOAPBinding soapBinding = (SOAPBinding) WebServicePortMetaData.getExtensibilityElement(binding.getExtensibilityElements(), SOAPBinding.class); + if (soapBinding != null) + style = soapBinding.getStyle(); + } + if (style == null) + style = "document"; + } + return style; + } + + /** + * Returns the SOAP action for the given operation. + * + * @param wsdlBindingOperation + * @return + */ + public String getSOAPAction() { + if (soapAction == null) { + final List wsdlBindingOperationExtensions = bindingOperation.getExtensibilityElements(); + final SOAPOperation soapOp = (SOAPOperation) WebServicePortMetaData.getExtensibilityElement(wsdlBindingOperationExtensions, SOAPOperation.class); + if (soapOp != null) + soapAction = soapOp.getSoapActionURI(); + } + return soapAction; + } + + public QName getRPCOperationName() { + if (rpcOperationName == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + String ns = (soapBody != null) ? soapBody.getNamespaceURI() : binding.getPortType().getQName().getNamespaceURI(); + String name = bindingOperation.getOperation().getName(); + rpcOperationName = new QName(ns, name); + } + return rpcOperationName; + } + + private List getSOAPBodyParts(boolean input) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(input); + if (soapBody != null) { + List parts = soapBody.getParts(); + if (parts!=null) { + List names = new ArrayList(); + for (Iterator i = parts.iterator(); i.hasNext();) { + Object part = i.next(); + if (part instanceof String) + names.add(part); + else if (part instanceof Part) { + names.add(((Part) part).getName()); + } + } + return names; + } else + return null; + } else + return null; + } + + private javax.wsdl.extensions.soap.SOAPBody getSOAPBody(boolean input) { + List elements = null; + if (input) { + BindingInput bindingInput = bindingOperation.getBindingInput(); + if (bindingInput == null) + return null; + elements = bindingInput.getExtensibilityElements(); + } else { + BindingOutput bindingOutput = bindingOperation.getBindingOutput(); + if (bindingOutput == null) + return null; + elements = bindingOutput.getExtensibilityElements(); + } + javax.wsdl.extensions.soap.SOAPBody soapBody = (javax.wsdl.extensions.soap.SOAPBody) WebServicePortMetaData.getExtensibilityElement(elements, + javax.wsdl.extensions.soap.SOAPBody.class); + return soapBody; + } + + /** + * Returns the use attribute + * + * @param wsdlOperation + * @return + */ + public String getUse() { + if (use == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + if (soapBody != null) { + use = soapBody.getUse(); + } + if (use == null) + use = "literal"; + } + return use; + } + + public String getEncoding() { + if (encoding == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + if (soapBody != null) { + List<String> styles=(List<String>)soapBody.getEncodingStyles(); + if (styles!=null && !styles.isEmpty()) + encoding = styles.get(0); + } + if (encoding == null) + encoding = ""; + } + return encoding; + } + + public boolean isDocLitWrapped() { + boolean flag = getStyle().equals("document") && getUse().equals("literal"); + if (!flag) + return false; + Message msg = getMessage(true); + if (msg == null) + return false; + List parts = msg.getOrderedParts(null); + if (parts.size() != 1) + return false; + Part part = (Part) parts.get(0); + QName element = part.getElementName(); + if (element == null) + return false; + return element.getLocalPart().equals(bindingOperation.getOperation().getName()); + } + + /* + public SOAPMediator createMediator(boolean serverMode) + throws SOAPException { + // create a new mediator for each invoke for thread-safety + boolean rpcStyle = getStyle().equals("rpc"); + boolean rpcEncoded = isEncoded(); + + SOAPMediator mediator = null; + + if (!rpcStyle) { + // Document + mediator = new SOAPDocumentLiteralMediatorImpl(this, serverMode); + } else { + if (!rpcEncoded) + mediator = new SOAPRPCLiteralMediatorImpl(this, serverMode); // RPC-literal + else + mediator = new SOAPRPCEncodedMediatorImpl(this, serverMode); // RPC-encoded + } + return mediator; + } + */ + + /** + * Get the operation signature from the WSDL operation + * + * @param wsdlBinding + * @param bindingOperation + * @return + */ + public List getOperationSignature() { + if (signature == null) { + signature = new ArrayList(); + + Operation operation = bindingOperation.getOperation(); + if (operation == null) + return signature; + + final Input input = operation.getInput(); + if (input == null) { + return signature; + } + + String style = getStyle(); + + if (style.equals("rpc")) { + Collection partNames = input.getMessage().getParts().values(); + for (Iterator i = partNames.iterator(); i.hasNext();) { + Part part = (Part) i.next(); + signature.add(part.getName()); + } + } else { + /* + * WS-I Basic Profile 1.1 4.7.6 Operation Signatures + * Definition: operation signature + * + * The profile defines the "operation signature" to be the + * fully qualified name of the child element of SOAP body of + * the SOAP input message described by an operation in a + * WSDL binding. + * + * In the case of rpc-literal binding, the operation name is + * used as a wrapper for the part accessors. In the + * document-literal case, since a wrapper with the operation + * name is not present, the message signatures must be + * correctly designed so that they meet this requirement. + * + * An endpoint that supports multiple operations must + * unambiguously identify the operation being invoked based + * on the input message that it receives. This is only + * possible if all the operations specified in the + * wsdl:binding associated with an endpoint have a unique + * operation signature. + * + * R2710 The operations in a wsdl:binding in a DESCRIPTION + * MUST result in operation signatures that are different + * from one another. + */ + List bodyParts = getSOAPBodyParts(true); + + Collection parts = input.getMessage().getParts().values(); + // Exclude the parts to be transmitted in SOAP header + if (bodyParts == null) + parts.removeAll(getInputHeaderParts()); + for (Iterator i = parts.iterator(); i.hasNext();) { + Part part = (Part) i.next(); + if (bodyParts == null) { + // All parts + QName elementName = part.getElementName(); + if (elementName == null) { + elementName = new QName("", part.getName()); + // TODO: [rfeng] throw new + // ServiceRuntimeException("Message part for + // document style must refer to an XSD element + // using a QName: " + part); + } + signature.add(elementName); + } else { + // "parts" in soap:body + if (bodyParts.contains(part.getName())) { + QName elementName = part.getElementName(); + if (elementName == null) { + elementName = new QName("", part.getName()); + // TODO: [rfeng] throw new + // ServiceRuntimeException("Message part for + // document style must refer to an XSD + // element using a QName: " + part); + } + signature.add(elementName); + } + + } + } + } + } + return signature; + } + + public Message getMessage(boolean isInput) { + Operation operation = bindingOperation.getOperation(); + if (operation == null) + return null; + + if (isInput) { + final Input input = operation.getInput(); + return input == null ? null : input.getMessage(); + } else { + final Output output = operation.getOutput(); + return output == null ? null : output.getMessage(); + } + } + + public Part getInputPart(int index) { + Part part = null; + Message message = getMessage(true); + if (message == null) + return part; + + List parts = message.getOrderedParts(null); + return (Part) parts.get(index); + + } + + public Part getOutputPart(int index) { + Part part = null; + Message message = getMessage(false); + if (message == null) + return part; + + List parts = message.getOrderedParts(null); + return (Part) parts.get(index); + + } + + /** + * Get a list of indexes for each part in the SOAP body + * + * @param isInput TODO + * @return + */ + public List getBodyPartIndexes(boolean isInput) { + List indexes = new ArrayList(); + + Message message = getMessage(isInput); + if (message == null) + return indexes; + + List bodyParts = getSOAPBodyParts(isInput); + List parts = message.getOrderedParts(null); + Set headerParts = (isInput) ? getInputHeaderParts() : getOutputHeaderParts(); + + int index = 0; + for (Iterator i = parts.iterator(); i.hasNext(); index++) { + Part part = (Part) i.next(); + if (headerParts.contains(part)) + continue; + if (bodyParts == null) { + // All parts + indexes.add(new Integer(index)); + } else { + // "parts" in soap:body + if (bodyParts.contains(part.getName())) + indexes.add(new Integer(index)); + + } + } + return indexes; + } + + /** + * Get the corresponding index for a part in the SOAP header by element + * name + * + * @param elementName + * @param isInput TODO + * @return + */ + public int getHeaderPartIndex(QName elementName, boolean isInput) { + + Message message = getMessage(isInput); + if (message == null) + return -1; + + List parts = message.getOrderedParts(null); + Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts(); + + int index = 0; + for (Iterator i = parts.iterator(); i.hasNext(); index++) { + Part part = (Part) i.next(); + // Test if the part is in header section + if (headerParts.contains(part) && elementName.equals(part.getElementName())) { + return index; + } + } + return -1; + } + + public BindingOperation getBindingOperation() { + return bindingOperation; + } + +}
\ No newline at end of file diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServicePortMetaData.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServicePortMetaData.java new file mode 100644 index 0000000000..9ce85d3ca8 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServicePortMetaData.java @@ -0,0 +1,362 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.handler; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import javax.wsdl.Binding; +import javax.wsdl.BindingOperation; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap.SOAPBinding; +import javax.xml.namespace.QName; +import javax.xml.soap.Name; +import javax.xml.soap.SOAPBodyElement; +import javax.xml.soap.SOAPElement; + +import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; + +/** + * Metadata for a WSDL port + * + */ +public class WebServicePortMetaData { + + private final static String SOAP_ENCODING_URI = "http://schemas.xmlsoap.org/wsdl/soap/"; + + private Service wsdlService; + private QName wsdlServiceName; + private Port wsdlPort; + private Binding wsdlBinding; + private QName wsdlPortName; + private PortType wsdlPortType; + private QName wsdlPortTypeName; + private String endpoint; + private boolean managed; + private List allOperationMetaData; + private WSDLServiceContract interfaceType; + + /** + * Constructor + * + * @param wsdlDefinition + * @param portName + */ + public WebServicePortMetaData(Definition wsdlDefinition, Port wsdlPort, String endpoint, boolean managed) { + + // Lookup the named port + this.wsdlPort=wsdlPort; + wsdlPortName = new QName(wsdlDefinition.getTargetNamespace(), wsdlPort.getName()); + + Collection<Service> services=(Collection<Service>)wsdlDefinition.getServices().values(); + for (Service service : services) { + if (service.getPorts().containsValue(wsdlPort)) { + wsdlService = service; + wsdlServiceName = service.getQName(); + break; + } + } + + // Save the binding + wsdlBinding = wsdlPort.getBinding(); + if (wsdlBinding == null) { + throw new IllegalArgumentException("WSDL binding cannot be found for " + wsdlPortName); + } + + // Save the portType + wsdlPortType = wsdlBinding.getPortType(); + if (wsdlPortType == null) { + throw new IllegalArgumentException("WSDL portType cannot be found for " + wsdlPortName); + } + wsdlPortTypeName = wsdlPortType.getQName(); + + // Save the endpoint + this.endpoint = endpoint; + + // Track if this endpoint is managed or not + this.managed = managed; + } + + /** + * Constructor + * + * @param serviceName + * @param portName + * @param portType + */ + public WebServicePortMetaData(QName serviceName, String portName, QName portTypeName, String endpoint) { + wsdlServiceName = serviceName; + wsdlPortName = new QName(serviceName.getNamespaceURI(), portName); + wsdlPortTypeName = portTypeName; + this.endpoint = endpoint; + } + + /** + * @return Returns the wsdlPort. + */ + public javax.wsdl.Port getPort() { + return wsdlPort; + } + + /** + * @return Returns the wsdlService. + */ + public QName getServiceName() { + return wsdlServiceName; + } + + /** + * @return Returns the wsdlService. + */ + public javax.wsdl.Service getService() { + return wsdlService; + } + + /** + * @return Returns the wsdlPortType. + */ + public PortType getPortType() { + return wsdlPortType; + } + + /** + * @return Returns the wsdlPortType. + */ + public QName getPortTypeName() { + return wsdlPortTypeName; + } + + /** + * @return Returns the wsdlBinding. + */ + public Binding getBinding() { + return wsdlBinding; + } + + /** + * @return Returns the wsdlPortName. + */ + public QName getPortName() { + return wsdlPortName; + } + + /** + * Returns the endpoint of a given port. + * + * @param wsdlPort + * @return + */ + public String getEndpoint() { + + // Return the specified endpoint + if (endpoint != null) + return endpoint; + + // Find the target endpoint on the port + if (wsdlPort != null) { + final List wsdlPortExtensions = wsdlPort.getExtensibilityElements(); + for (Iterator i = wsdlPortExtensions.iterator(); i.hasNext();) { + final Object extension = i.next(); + if (extension instanceof SOAPAddress) { + final SOAPAddress address = (SOAPAddress) extension; + return address.getLocationURI(); + } + } + } + + return null; + } + + /** + * Returns the SOAP binding style. + * @return + */ + public String getStyle() { + + // Find the binding style + String style = null; + if (wsdlBinding != null) { + final List wsdlBindingExtensions = wsdlBinding.getExtensibilityElements(); + SOAPBinding soapBinding = (SOAPBinding) getExtensibilityElement(wsdlBindingExtensions, SOAPBinding.class); + if (soapBinding != null) + style = soapBinding.getStyle(); + } + + // Default to document + return (style == null) ? "document" : style; + } + + /** + * Returns the use attribute + * @return + */ + public String getUse() { + List list = getAllOperationMetaData(); + WebServiceOperationMetaData operationMetaData = (WebServiceOperationMetaData) list.get(0); + return operationMetaData.getUse(); + } + + /** + * Returns the encoding attribute + * @return + */ + public String getEncoding() { + List list = getAllOperationMetaData(); + WebServiceOperationMetaData operationMetaData = (WebServiceOperationMetaData) list.get(0); + return operationMetaData.getEncoding(); + } + + /** + * @return Returns true if this is a managed web service. + */ + public boolean isManaged() { + return managed; + } + + /** + * Returns the first extensibility element of the given type. + * @param elements + * @param type + * @return + */ + public static Object getExtensibilityElement(List elements, Class type) { + for (Iterator i = elements.iterator(); i.hasNext();) { + Object element = i.next(); + if (type.isInstance(element)) + return element; + } + return null; + } + + /** + * Returns the extensibility elements of the given type. + * @param elements + * @param type + * @return + */ + public static List getExtensibilityElements(List elements, Class type) { + List result = new ArrayList(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object element = i.next(); + if (type.isInstance(element)) + result.add(element); + } + return result; + } + + /** + * Get the operation signature from the SOAP Body + * @param body + * @return A list of QNames + */ + public static List getOperationSignature(javax.xml.soap.SOAPBody body) { + List signature = new ArrayList(); + for (Iterator i = body.getChildElements(); i.hasNext();) { + Object child = i.next(); + if (child instanceof SOAPBodyElement) { + Name name = ((SOAPBodyElement) child).getElementName(); + QName qname = new QName(name.getURI(), name.getLocalName(), name.getPrefix()); + signature.add(qname); + } + } + return signature; + } + + public static List getRPCOperationSignature(javax.xml.soap.SOAPBody body) { + List signature = new ArrayList(); + for (Iterator i = body.getChildElements(); i.hasNext();) { + Object child = i.next(); + if (child instanceof SOAPBodyElement) { + SOAPBodyElement op = ((SOAPBodyElement) child); + for (Iterator j = op.getChildElements(); j.hasNext();) { + Object part = i.next(); + if (part instanceof SOAPElement) { + SOAPElement p = (SOAPElement) part; + signature.add(p.getLocalName()); + } + } + } + } + return signature; + } + + public WebServiceOperationMetaData getOperationMetaData(javax.xml.soap.SOAPBody body) { + List s1 = getOperationSignature(body); + // List rpcParts = getRPCOperationSignature(body); + for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) { + WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next(); + + String style = descriptor.getStyle(); + + if (style.equals("document")) { + List s2 = descriptor.getOperationSignature(); + if (s1.equals(s2)) + return descriptor; + } else { + QName op1 = (QName) s1.get(0); + QName op2 = descriptor.getRPCOperationName(); + if (op1.equals(op2)) { + /* + * // FIXME: [rfeng] We don't support method overloading + * List partNames = getOperationSignature(binding, + * bindingOperation); if (rpcParts.equals(partNames)) + */ + return descriptor; + } + } + } + return null; + } + + public List getAllOperationMetaData() { + if (allOperationMetaData == null) { + allOperationMetaData = new ArrayList(); + for (Iterator it = wsdlBinding.getBindingOperations().iterator(); it.hasNext();) { + final BindingOperation bindingOperation = (BindingOperation) it.next(); + if (bindingOperation.getOperation() != null) + allOperationMetaData.add(new WebServiceOperationMetaData(wsdlBinding, bindingOperation)); + } + } + return allOperationMetaData; + } + + public WebServiceOperationMetaData getOperationMetaData(String operationName) { + for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) { + WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next(); + String opName = descriptor.getBindingOperation().getOperation().getName(); + + if (opName.equals(operationName)) + return descriptor; + } + return null; + } + + /** + * Returns the WSDL service contract + * @return + */ + public WSDLServiceContract getInterfaceType() { + return interfaceType; + } + +}
\ No newline at end of file diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/loader/WebServiceSCDLModelLoader.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/loader/WebServiceSCDLModelLoader.java new file mode 100644 index 0000000000..e60d77525f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/loader/WebServiceSCDLModelLoader.java @@ -0,0 +1,74 @@ +package org.apache.tuscany.binding.axis.loader; + +import org.apache.tuscany.binding.axis.assembly.WebServiceAssemblyFactory; +import org.apache.tuscany.binding.axis.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis.assembly.impl.WebServiceAssemblyFactoryImpl; +import org.apache.tuscany.binding.axis.assembly.impl.WebServiceBindingImpl; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.loader.SCDLModelLoaderRegistry; +import org.apache.tuscany.model.assembly.AssemblyModelContext; +import org.apache.tuscany.model.assembly.AssemblyModelObject; +import org.apache.tuscany.model.scdl.loader.SCDLModelLoader; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Destroy; + +/** + * Populates the assembly model from an SCDL model + */ +@org.osoa.sca.annotations.Scope("MODULE") +public class WebServiceSCDLModelLoader implements SCDLModelLoader { + + private RuntimeContext runtimeContext; + private SCDLModelLoaderRegistry loaderRegistry; + private WebServiceAssemblyFactory wsFactory; + + /** + * Constructs a new WebServiceSCDLModelLoader. + */ + public WebServiceSCDLModelLoader() { + this.wsFactory=new WebServiceAssemblyFactoryImpl(); + } + + /** + * @param runtimeContext The runtimeContext to set. + */ + @Autowire + public void setRuntimeContext(RuntimeContext runtimeContext) { + this.runtimeContext = runtimeContext; + } + + // @Autowire + public void setLoaderRegistry(SCDLModelLoaderRegistry registry) { + this.loaderRegistry = registry; + } + + @Init(eager=true) + public void init() { + runtimeContext.addLoader(this); +// loaderRegistry.registerLoader(this); + } + + @Destroy + public void destroy() { + loaderRegistry.unregisterLoader(this); + } + + /** + * @see org.apache.tuscany.model.scdl.loader.SCDLModelLoader#load(org.apache.tuscany.model.assembly.AssemblyModelContext, java.lang.Object) + */ + public AssemblyModelObject load(AssemblyModelContext modelContext, Object object) { + if (object instanceof org.apache.tuscany.model.scdl.WebServiceBinding) { + org.apache.tuscany.model.scdl.WebServiceBinding scdlBinding=(org.apache.tuscany.model.scdl.WebServiceBinding)object; + WebServiceBinding binding=wsFactory.createWebServiceBinding(); + binding.setURI(scdlBinding.getUri()); + + // Set the port URI into the assembly binding, it'll be resolved in the initialize method + ((WebServiceBindingImpl)binding).setPortURI(scdlBinding.getPort()); + + return binding; + + } else + return null; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/resources/org/apache/tuscany/binding/axis/Messages.properties b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/resources/org/apache/tuscany/binding/axis/Messages.properties new file mode 100644 index 0000000000..ac3fc641e5 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/resources/org/apache/tuscany/binding/axis/Messages.properties @@ -0,0 +1,28 @@ +# ==================================================================== +# Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed 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. +# ==================================================================== + +# ==================================================================== +# To code developer: +# Do NOT change the properties between this line and the +# "%%% END OF TRANSLATED PROPERTIES %%%" line. +# Make a new property name, append to the end of the file and change +# the code to use the new property. +# ==================================================================== + +# ===================================================================== +# %%% END OF TRANSLATED PROPERTIES %%% +# ===================================================================== +# NLS_MESSAGEFORMAT_ALL diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/resources/org/apache/tuscany/binding/axis/engine/config/server-config.wsdd b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/resources/org/apache/tuscany/binding/axis/engine/config/server-config.wsdd new file mode 100644 index 0000000000..6790888ee6 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/resources/org/apache/tuscany/binding/axis/engine/config/server-config.wsdd @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ -->
+<deployment name="defaultClientConfig"
+ xmlns="http://xml.apache.org/axis/wsdd/"
+ xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
+ xmlns:handler="http://xml.apache.org/axis/wsdd/providers/handler">
+
+ <globalConfiguration>
+ <parameter name="disablePrettyXML" value="false"/>
+ <parameter name="dotNetSoapEncFix" value="true"/>
+ <parameter name="axis.servicesPath" value="/sca/"/>
+ <parameter name="axis.disableServiceList" value="true"/>
+
+ <requestFlow>
+ <handler type="java:org.apache.axis.handlers.SOAPMonitorHandler"/>
+ </requestFlow>
+ <responseFlow>
+ <handler type="java:org.apache.axis.handlers.SOAPMonitorHandler"/>
+ </responseFlow>
+
+ </globalConfiguration>
+
+ <handler type="java:org.apache.axis.handlers.http.URLMapper" name="URLMapper"/>
+ <handler type="java:org.apache.axis.transport.local.LocalResponder" name="LocalResponder"/>
+ <handler type="java:org.apache.axis.handlers.SimpleAuthenticationHandler" name="Authenticate"/>
+
+ <transport name="http">
+ <parameter name="qs:list"
+ value="org.apache.axis.transport.http.QSListHandler"/>
+ <parameter name="qs:method"
+ value="org.apache.axis.transport.http.QSMethodHandler"/>
+ <parameter name="qs:wsdl"
+ value="org.apache.axis.transport.http.QSWSDLHandler"/>
+ <requestFlow>
+ <handler type="URLMapper"/>
+ <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
+ </requestFlow>
+ </transport>
+
+ <transport name="local">
+ <responseFlow>
+ <handler type="LocalResponder"/>
+ </responseFlow>
+ </transport>
+
+</deployment>
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/resources/system.fragment b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/resources/system.fragment new file mode 100644 index 0000000000..ebfefa309a --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/main/resources/system.fragment @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + Licensed 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. + --> +<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" + xmlns:system="http://org.apache.tuscany/xmlns/system/0.9" + name="org.apache.tuscany.binding.axis"> + + <component name="org.apache.tuscany.binding.axis.builder.ExternalWebServiceConfigurationBuilder"> + <system:implementation.system class="org.apache.tuscany.binding.axis.builder.ExternalWebServiceConfigurationBuilder"/> + </component> + + <component name="org.apache.tuscany.binding.axis.builder.ExternalWebServiceWireBuilder"> + <system:implementation.system class="org.apache.tuscany.binding.axis.builder.ExternalWebServiceWireBuilder"/> + </component> + + <component name="org.apache.tuscany.binding.axis.loader.WebServiceSCDLModelLoader"> + <system:implementation.system class="org.apache.tuscany.binding.axis.loader.WebServiceSCDLModelLoader"/> + </component> + + <component name="org.apache.tuscany.binding.axis.builder.WebServiceEntryPointConfigurationBuilder"> + <system:implementation.system class="org.apache.tuscany.binding.axis.builder.WebServiceEntryPointConfigurationBuilder"/> + </component> + +</moduleFragment> diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/WebServiceAssemblyLoaderTestCase.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/WebServiceAssemblyLoaderTestCase.java new file mode 100644 index 0000000000..6c8b58b0d1 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/WebServiceAssemblyLoaderTestCase.java @@ -0,0 +1,87 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.binding.axis.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis.loader.WebServiceSCDLModelLoader; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.AssemblyModelContext; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl; +import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; +import org.apache.tuscany.model.scdl.loader.SCDLModelLoader; +import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl; + +/** + */ +public class WebServiceAssemblyLoaderTestCase extends TestCase { + + /** + * + */ + public WebServiceAssemblyLoaderTestCase() { + super(); + } + + public void testLoader() { + + ResourceLoader resourceLoader=new ResourceLoaderImpl(Thread.currentThread().getContextClassLoader()); + WebServiceSCDLModelLoader wsLoader=new WebServiceSCDLModelLoader(); + List<SCDLModelLoader> scdlLoaders=new ArrayList<SCDLModelLoader>(); + scdlLoaders.add(wsLoader); + AssemblyModelLoader assemblyLoader=new SCDLAssemblyModelLoaderImpl(scdlLoaders); + AssemblyFactory assemblyFactory=new AssemblyFactoryImpl(); + AssemblyModelContext modelContext=new AssemblyModelContextImpl(assemblyFactory, assemblyLoader, resourceLoader); + + Module module = assemblyLoader.loadModule(getClass().getResource("sca.module").toString()); + module.initialize(modelContext); + + Assert.assertTrue(module.getName().equals("tuscany.binding.axis.assembly.tests.bigbank.account")); + + Component component = module.getComponent("AccountServiceComponent"); + Assert.assertTrue(component != null); + + EntryPoint entryPoint = module.getEntryPoint("AccountService"); + Assert.assertTrue(entryPoint != null); + + ExternalService externalService = module.getExternalService("StockQuoteService"); + Assert.assertTrue(externalService != null); + + Binding binding = externalService.getBindings().get(0); + Assert.assertTrue(binding instanceof WebServiceBinding); + } + + protected void setUp() throws Exception { + super.setUp(); + + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountReport.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountReport.java new file mode 100644 index 0000000000..6ac32e9c9a --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountReport.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.account; + +import java.util.List; + +/** + * @model + */ + +public interface AccountReport { + + /** + * @model type="services.account.AccountSummary" + */ + + List getAccountSummaries(); +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountService.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountService.java new file mode 100644 index 0000000000..58f842878d --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountService.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.account; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface AccountService { + + public AccountReport getAccountReport(String customerID); +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java new file mode 100644 index 0000000000..91fd5e0164 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.account; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +import org.apache.tuscany.binding.axis.assembly.tests.bigbank.account.services.accountdata.AccountDataService; +import org.apache.tuscany.binding.axis.assembly.tests.bigbank.account.services.stockquote.StockQuoteService; + +public class AccountServiceImpl implements AccountService { + + @Property + public String currency = "USD"; + + @Reference + public AccountDataService accountDataService; + @Reference + public StockQuoteService stockQuoteService; + + public AccountServiceImpl() { + } + + public AccountReport getAccountReport(String customerID) { + return null; + } + +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountSummary.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountSummary.java new file mode 100644 index 0000000000..85825013a2 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountSummary.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.account; + +/** + * @model + */ + +public interface AccountSummary { + + /** + * @model + */ + String getAccountNumber(); + + void setAccountNumber(String accountNumber); + + /** + * @model + */ + String getAccountType(); + + void setAccountType(String accountType); + + /** + * @model + */ + float getBalance(); + + void setBalance(float balance); +} + diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..4242d2fcc7 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.accountdata; + +public interface AccountDataService { + + CheckingAccount getCheckingAccount(String customerID); + + SavingsAccount getSavingsAccount(String customerID); + + StockAccount getStockAccount(String customerID); +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..66ae034d9a --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.accountdata; + +public class AccountDataServiceImpl implements AccountDataService { + + public CheckingAccount getCheckingAccount(String customerID) { + + CheckingAccount checkingAccount = new CheckingAccount(); + checkingAccount.setAccountNumber(customerID + "_" + "CHA12345"); + checkingAccount.setBalance(1500.0f); + + return checkingAccount; + } + + public SavingsAccount getSavingsAccount(String customerID) { + + SavingsAccount savingsAccount = new SavingsAccount(); + savingsAccount.setAccountNumber(customerID + "_" + "SAA12345"); + savingsAccount.setBalance(1500.0f); + + return savingsAccount; + } + + public StockAccount getStockAccount(String customerID) { + + StockAccount stockAccount = new StockAccount(); + stockAccount.setAccountNumber(customerID + "_" + "STA12345"); + stockAccount.setSymbol("IBM"); + stockAccount.setQuantity(100); + + return stockAccount; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java new file mode 100644 index 0000000000..6c48b7120a --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.accountdata; + +public class CheckingAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java new file mode 100644 index 0000000000..718145feb5 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.accountdata; + +public class SavingsAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/StockAccount.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/StockAccount.java new file mode 100644 index 0000000000..05f7644d80 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/accountdata/StockAccount.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.accountdata; + +public class StockAccount { + + private String accountNumber; + private String symbol; + private int quantity; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..a1c8f131a1 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/java/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed 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.binding.axis.assembly.tests.bigbank.account.services.stockquote; + +public interface StockQuoteService { + + public float getQuote(String symbol); +} + +
\ No newline at end of file diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountService.wsdl b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountService.wsdl new file mode 100644 index 0000000000..921218c5b9 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountService.wsdl @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/AccountService/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.bigbank.com/AccountService/"
+
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/AccountService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="customerID" type="xsd:string"/>
+ <xsd:element name="getAccountReportResponse" type="tns:AccountReport"/>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummary" type="tns:AccountSummary" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string"/>
+ <xsd:element name="accountType" type="xsd:string"/>
+ <xsd:element name="balance" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:customerID" name="getAccountReportRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse" name="getAccountReportResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest"/>
+ <wsdl:output message="tns:getAccountReportResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/AccountService/getAccountReport"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address location=""/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl new file mode 100644 index 0000000000..9678d9d6ea --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<wsdl:definitions targetNamespace="http://webservice.stockquote" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.stockquote" xmlns:intf="http://webservice.stockquote" xmlns:tns1="http://stockquote" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="GetQuoteRequest">
+ <sequence>
+ <element name="symbol" nillable="true" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <complexType name="GetQuoteResponse">
+ <sequence>
+ <element name="price" type="xsd:float"/>
+ </sequence>
+ </complexType>
+ </schema>
+ <schema elementFormDefault="qualified" targetNamespace="http://webservice.stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://stockquote"/>
+ <element name="request" type="tns1:GetQuoteRequest"/>
+ <element name="getQuoteReturn" type="tns1:GetQuoteResponse"/>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getQuoteResponse">
+
+ <wsdl:part element="impl:getQuoteReturn" name="getQuoteReturn"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getQuoteRequest">
+
+ <wsdl:part element="impl:request" name="request"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="StockQuoteWebService">
+
+ <wsdl:operation name="getQuote" parameterOrder="request">
+
+ <wsdl:input message="impl:getQuoteRequest" name="getQuoteRequest"/>
+
+ <wsdl:output message="impl:getQuoteResponse" name="getQuoteResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockQuoteWebServiceSoapBinding" type="impl:StockQuoteWebService">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getQuote">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getQuoteRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getQuoteResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockQuoteWebServiceService">
+
+ <wsdl:port binding="impl:StockQuoteWebServiceSoapBinding" name="StockQuoteWebService">
+
+ <wsdlsoap:address location="http://localhost:8123/StockQuoteWebService/services/StockQuoteWebService"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/assembly/tests/sca.module b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/assembly/tests/sca.module new file mode 100644 index 0000000000..7057907864 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/assembly/tests/sca.module @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+
+ name="tuscany.binding.axis.assembly.tests.bigbank.account">
+
+ <entryPoint name="AccountService">
+ <interface.java interface="org.apache.tuscany.binding.axis.assembly.tests.bigbank.account.services.account.AccountService"/>
+ <binding.ws port="http://www.bigbank.com/AccountService/#AccountServiceSOAP"/>
+ <reference>AccountExternalService</reference>
+ </entryPoint>
+
+ <entryPoint name="AccountService2"> + <interface.wsdl interface="http://www.bigbank.com/AccountService/#AccountService"/> + <binding.ws port="http://www.bigbank.com/AccountService/#AccountServiceSOAP"/> + <reference>AccountExternalService</reference> + </entryPoint> + + <component name="AccountServiceComponent">
+ <implementation.java class="org.apache.tuscany.binding.axis.assembly.tests.bigbank.account.services.account.AccountServiceImpl"/>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="org.apache.tuscany.binding.axis.assembly.tests.bigbank.account.services.accountdata.AccountDataServiceImpl"/>
+ </component>
+
+ <!--
+ <component name="StockQuoteService">
+ <implementation.java class="org.apache.tuscany.binding.axis.assembly.tests.bigbank.account.services.stockquote.StockQuoteServiceImpl"/>
+ </component>
+ -->
+
+ <externalService name="AccountExternalService"> + <interface.wsdl interface="http://www.bigbank.com/AccountService/#AccountService"/> + <binding.ws port="http://www.bigbank.com/AccountService/#AccountServiceSOAP"/> + </externalService> + + <externalService name="StockQuoteService">
+ <interface.java interface="org.apache.tuscany.binding.axis.assembly.tests.bigbank.account.services.stockquote.StockQuoteService"/>
+ <binding.ws port="http://webservice.stockquote#StockQuoteWebService"/>
+ </externalService> + + <import.wsdl + location="org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/account/AccountService.wsdl" + namespace="http://www.bigbank.com/AccountService/"/> + + <import.wsdl + location="org/apache/tuscany/binding/axis/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl" + namespace="http://webservice.stockquote"/> + +</module>
+
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/DocLit.wsdl b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/DocLit.wsdl new file mode 100644 index 0000000000..4aec526803 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/DocLit.wsdl @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.example.org/Test/DocLit"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test"
+ targetNamespace="http://www.example.org/Test/DocLit">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.example.org/Test/DocLit"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://www.example.org/Test/DocLit">
+ <xsd:element name="source" type="xsd:string"/>
+ <xsd:element name="target" type="xsd:string"/>
+ <xsd:element name="context" type="xsd:string"/>
+ <xsd:element name="index" type="xsd:int"/>
+ <xsd:element name="exception" type="xsd:string"/>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="testRequest">
+ <wsdl:part element="tns:source" name="part1"/>
+ <wsdl:part element="tns:target" name="part2"/>
+ <wsdl:part element="tns:context" name="part3"/>
+ </wsdl:message>
+ <wsdl:message name="testResponse">
+ <wsdl:part element="tns:index" name="part1"/>
+ </wsdl:message>
+ <wsdl:message name="testFault">
+ <wsdl:part name="testFault" element="tns:exception"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Test">
+ <wsdl:operation name="indexOf">
+ <wsdl:input name="input" message="tns:testRequest"/>
+ <wsdl:output name="output" message="tns:testResponse"/>
+ <wsdl:fault name="fault" message="tns:testFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="TestSOAP" type="tns:Test">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="indexOf">
+ <soap:operation
+ soapAction="http://www.example.org/Test/indexOf"/>
+ <wsdl:input>
+ <soap:body parts="part1 part2" use="literal"/>
+ <soap:header message="tns:testRequest" part="part3" use="literal"></soap:header>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="fault">
+ <soap:fault namespace="http://www.example.org/Test/"
+ use="literal" name="fault"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Test">
+ <wsdl:port binding="tns:TestSOAP" name="TestSOAP">
+ <soap:address
+ location="http://localhost:8080/TestWebServiceMediator/services/Test"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/DocLitWrapped.wsdl b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/DocLitWrapped.wsdl new file mode 100644 index 0000000000..7839d3ea71 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/DocLitWrapped.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.example.org/Test/DocLitWrapped"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test"
+ targetNamespace="http://www.example.org/Test/DocLitWrapped">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.example.org/Test/DocLitWrapped"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/Test/DocLitWrapped">
+ <xsd:element name="indexOf">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="source" type="xsd:string"/>
+ <xsd:element name="target" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="indexOfResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="index" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="exception" type="xsd:string"/>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="testRequest">
+ <wsdl:part element="tns:indexOf" name="part1"/>
+ </wsdl:message>
+ <wsdl:message name="testResponse">
+ <wsdl:part element="tns:indexOfResponse" name="part1"/>
+ </wsdl:message>
+ <wsdl:message name="testFault">
+ <wsdl:part name="testFault" element="tns:exception"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Test">
+ <wsdl:operation name="indexOf">
+ <wsdl:input name="input" message="tns:testRequest"/>
+ <wsdl:output name="output" message="tns:testResponse"/>
+ <wsdl:fault name="fault" message="tns:testFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="TestSOAP" type="tns:Test">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="indexOf">
+ <soap:operation
+ soapAction="http://www.example.org/Test/indexOf"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="fault">
+ <soap:fault namespace="http://www.example.org/Test/"
+ use="literal" name="fault"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Test">
+ <wsdl:port binding="tns:TestSOAP" name="TestSOAP">
+ <soap:address
+ location="http://localhost:8080/TestWebServiceMediator/services/Test"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/RpcLit.wsdl b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/RpcLit.wsdl new file mode 100644 index 0000000000..8f94f9c66f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/RpcLit.wsdl @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.example.org/Test/RpcLit"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test"
+ targetNamespace="http://www.example.org/Test/RpcLit">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.example.org/Test/RpcLit"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://www.example.org/Test/RpcLit">
+ <!--
+ <xsd:element name="source" type="xsd:string"/>
+ <xsd:element name="target" type="xsd:string"/>
+ <xsd:element name="index" type="xsd:int" />
+ -->
+ <xsd:element name="exception" type="xsd:string"/>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="testRequest">
+ <wsdl:part type="xsd:string" name="part1"/>
+ <wsdl:part type="xsd:string" name="part2"/>
+ </wsdl:message>
+ <wsdl:message name="testResponse">
+ <wsdl:part type="xsd:int" name="part1"/>
+ </wsdl:message>
+ <wsdl:message name="testFault">
+ <wsdl:part name="testFault" element="tns:exception"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Test">
+ <wsdl:operation name="indexOf">
+ <wsdl:input name="input" message="tns:testRequest"/>
+ <wsdl:output name="output" message="tns:testResponse"/>
+ <wsdl:fault name="fault" message="tns:testFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="TestSOAP" type="tns:Test">
+ <soap:binding style="rpc"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="indexOf">
+ <soap:operation
+ soapAction="http://www.example.org/Test/indexOf"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="fault">
+ <soap:fault namespace="http://www.example.org/Test/"
+ use="literal" name="fault"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Test">
+ <wsdl:port binding="tns:TestSOAP" name="TestSOAP">
+ <soap:address
+ location="http://localhost:8080/TestWebServiceMediator/services/Test"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/sca.module b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/sca.module new file mode 100644 index 0000000000..7d8bb7861f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/sca/binding.axis/src/test/resources/org/apache/tuscany/binding/axis/mediator/tests/sca.module @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="TestModule">
+
+</module>
|