diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java index e131ea83b0..8839bb9679 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java +++ b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java @@ -134,6 +134,7 @@ public class WSDLServiceGenerator { //[nash] changes to the builder sequence avoid calling this for a CompositeService assert !(contract instanceof CompositeService); + boolean generatedWsdl = false; String contractName = contract.getName(); List<Port> ports = new ArrayList<Port>(); @@ -243,6 +244,7 @@ public class WSDLServiceGenerator { def = newDef; } else { + generatedWsdl = true; // The WSDL definition was generated by Interface2WSDLGenerator. // Reuse it instead of creating a new definition here. } @@ -252,7 +254,18 @@ public class WSDLServiceGenerator { new WSDLDefinitionGenerator(wsBinding); WSDLInterface wi = (WSDLInterface)wsBinding.getBindingInterfaceContract().getInterface(); PortType portType = wi.getPortType(); - Service service = helper.createService(def, portType, contract.getName()); + // If using the WSDL definition that was generated by Interface2WSDLGenerator, + // add the component name to the WSDL service name. This is done so that the + // WSDL service name doesn't clash with other components that use the same contract. + // The runtime may have a need to keep the WSDL services separate, e.g. to support + // different policy attachments on each service. It isn't necessary to add the + // component name when using user-supplied WSDL because in that case the above code + // created a new WSDL document in a namespace that is qualified by the component name. + String wsdlServiceName = contract.getName(); + if (generatedWsdl) { + wsdlServiceName = component.getURI().replace('/','_') + '_' + wsdlServiceName; + } + Service service = helper.createService(def, portType, wsdlServiceName); if (wsBinding.getBinding() == null && ports.size() == 0) { Binding binding = helper.createBinding(def, portType); if (BindingWSDLGenerator.requiresSOAP12(wsBinding)) { |