diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca')
2 files changed, 43 insertions, 6 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java index 920b9c43fc..fd53de6a2c 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java @@ -39,6 +39,7 @@ import javax.xml.ws.Dispatch; import javax.xml.ws.Service; import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; +import javax.xml.ws.soap.SOAPBinding; import javax.xml.ws.soap.SOAPFaultException; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; @@ -78,20 +79,36 @@ public class JAXWSBindingInvoker implements Invoker, DataExchangeSemantics { } private Dispatch<SOAPMessage> createDispatch(WebServiceBinding wsBinding) { - // FIXME: What should we do if the WSDL is generated in memory? URL wsdlLocation = null; try { wsdlLocation = new URL(wsBinding.getWSDLDocument().getDocumentBaseURI()); } catch (MalformedURLException e) { try { - wsdlLocation = wsBinding.getWSDLDefinition().getLocation().toURL(); + if (wsBinding.getWSDLDefinition().getLocation() != null){ + wsdlLocation = wsBinding.getWSDLDefinition().getLocation().toURL(); + } } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } - Service service = Service.create(wsdlLocation, wsBinding.getServiceName()); - return service.createDispatch(new QName(wsBinding.getServiceName().getNamespaceURI(), wsBinding.getPortName()), + + QName serviceName = null; + QName portName = null; + Service service = null; + + if (wsdlLocation != null){ + serviceName = wsBinding.getServiceName(); + portName = new QName(serviceName.getNamespaceURI(), wsBinding.getPortName()); + service = Service.create(wsdlLocation, serviceName); + } else { + serviceName = wsBinding.getService().getQName(); + portName = new QName(serviceName.getNamespaceURI(), wsBinding.getPort().getName()); + service = Service.create(serviceName); + service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, wsBinding.getURI()); + } + + return service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE); } diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java index 95e64f5ad2..3055f1a14a 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java @@ -80,12 +80,32 @@ public class JAXWSServiceBindingProvider implements ServiceBindingProvider, Prov // Set to use the DOM data binding InterfaceContract contract = wsBinding.getBindingInterfaceContract(); contract.getInterface().resetDataBinding(Node.class.getName()); - + + // Can we safely assume there is only one port because you configure + // a binding in the following ways: + // 1/ default - one port generated = host domain : host port / structural path + // 2/ uri="absolute addr" - one port generated = host domain : uri port / uri path + // 3/ uri="relative addr" - one port generated = host domain : host port / structural path / relative path + // 4/ wsdl.binding - one port generated = host domain : host port / structural path + // 5/ wsdl.port - one port generated = host domain : port port / port path + // 6/ wsa:Address - one port generated = host domain : address port / address path + // 7/ 4 + 6 - as 6 + + // TODO the binding URI will currently have been calculated during build + // however we don't give the provider a chance to get in and effect the + // calculation (see above comment). For now just fake the addition of binding + // specific processing by adding a root if it's not already present + if (!wsBinding.getURI().startsWith("http://")) { + wsBinding.setURI("http://localhost:8085" + wsBinding.getURI()); + } } public void start() { + // TODO - turn on Axis2 JAXWS support + + wsEndpoint = Endpoint.create(this); - wsEndpoint.publish("http://localhost:8085" + wsBinding.getURI()); + wsEndpoint.publish(wsBinding.getURI()); } public void stop() { |