diff options
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca')
3 files changed, 46 insertions, 6 deletions
diff --git a/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java index cbdeec2b4a..7f1d07618f 100644 --- a/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java +++ b/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java @@ -109,7 +109,7 @@ public class Interface2WSDLGenerator { super(); this.requiresSOAP12 = requiresSOAP12; this.resolver = resolver; - definitionGenerator = new WSDLDefinitionGenerator(requiresSOAP12); + definitionGenerator = new WSDLDefinitionGenerator(requiresSOAP12, false); this.dataBindings = dataBindings; this.xsdFactory = xsdFactory; this.monitor = monitor; diff --git a/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java b/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java index d0b79f9b0e..989a12d43c 100644 --- a/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java +++ b/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java @@ -76,15 +76,17 @@ public class WSDLDefinitionGenerator { private static final String PORT_SUFFIX = "Port"; private boolean requiresSOAP12; + private boolean requiresJMS; private QName soapAddress; private QName soapBinding; private QName soapBody; private QName soapFault; private QName soapOperation; - public WSDLDefinitionGenerator(boolean requiresSOAP12) { + public WSDLDefinitionGenerator(boolean requiresSOAP12, boolean requiresJMS) { super(); this.requiresSOAP12 = requiresSOAP12; + this.requiresJMS = requiresJMS; soapAddress = requiresSOAP12 ? SOAP12_ADDRESS : SOAP_ADDRESS; soapBinding = requiresSOAP12 ? SOAP12_BINDING : SOAP_BINDING; soapBody = requiresSOAP12 ? SOAP12_BODY : SOAP_BODY; @@ -114,10 +116,18 @@ public class WSDLDefinitionGenerator { definition.getExtensionRegistry().createExtension(Binding.class, soapBinding); if (requiresSOAP12) { ((SOAP12Binding)bindingExtension).setStyle("document"); - ((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http"); + if (requiresJMS){ + ((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/jms"); + } else { + ((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http"); + } } else { ((SOAPBinding)bindingExtension).setStyle("document"); - ((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http"); + if (requiresJMS){ + ((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/jms"); + } else { + ((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http"); + } } binding.addExtensibilityElement(bindingExtension); return binding; @@ -126,6 +136,7 @@ public class WSDLDefinitionGenerator { } } + protected void configureBinding(Definition definition, Binding binding, PortType portType) throws WSDLException { QName portTypeName = portType.getQName(); if (portTypeName != null) { diff --git a/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java b/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java index bf3615c9f8..1fbf834e86 100644 --- a/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java +++ b/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java @@ -147,7 +147,10 @@ public class WSDLServiceGenerator { return null; } Definition def = wsdlDefinition.getDefinition(); - if (wsdlDefinition.getBinding() == null) { + + boolean wsdlProvidedByUser = (wsdlDefinition.getBinding() == null); + + if (wsdlProvidedByUser) { // The WSDL document was provided by the user. Generate a new // WSDL document with imports from the user-provided document. WSDLFactory factory = null; @@ -253,7 +256,7 @@ public class WSDLServiceGenerator { // add a service and ports to the generated definition WSDLDefinitionGenerator helper = - new WSDLDefinitionGenerator(BindingWSDLGenerator.requiresSOAP12(wsBinding)); + new WSDLDefinitionGenerator(BindingWSDLGenerator.requiresSOAP12(wsBinding),false); WSDLInterface wi = (WSDLInterface)wsBinding.getBindingInterfaceContract().getInterface(); PortType portType = wi.getPortType(); Service service = helper.createService(def, portType); @@ -298,6 +301,32 @@ public class WSDLServiceGenerator { } wsBinding.setService(service); } + + // TUSCANY-2900 - add jms binding and service port if required + // TODO - remove service/ports from any imported WSDL + // - find away to allow users to retrieve WSDL with JMS bindings + // as a jms binding on it's own provides not target for ?wsdl + if ((!wsdlProvidedByUser) && + (wsBinding.getURI() != null) && + (wsBinding.getURI().startsWith("jms"))){ + + // need to work out how to check if user has already specified a binding + + // create jms binding + helper = new WSDLDefinitionGenerator(BindingWSDLGenerator.requiresSOAP12(wsBinding),true); + Binding binding = helper.createBinding(def, portType); + helper.createBindingOperations(def, binding, portType); + binding.setUndefined(false); + def.addBinding(binding); + + // create a jms port + String endpointURI = computeActualURI(wsBinding, null); + Port port = helper.createPort(def, binding, service, endpointURI); + wsBinding.setService(service); + wsBinding.setPort(port); + + //printWSDL = true; + } // for debugging if (printWSDL) { |