diff options
Diffstat (limited to 'sca-java-2.x/trunk')
3 files changed, 51 insertions, 6 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/binding-ws/META-INF/MANIFEST.MF index 2ff6bb8547..2df0f0f2e2 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/META-INF/MANIFEST.MF +++ b/sca-java-2.x/trunk/modules/binding-ws/META-INF/MANIFEST.MF @@ -17,6 +17,9 @@ Bundle-ManifestVersion: 2 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-Description: Apache Tuscany SCA WS Binding Model
Import-Package: javax.wsdl,
+ javax.wsdl.extensions;version="1.6.2",
+ javax.wsdl.extensions.soap;version="1.6.2",
+ javax.wsdl.extensions.soap12;version="1.6.2",
javax.xml.namespace,
javax.xml.parsers,
javax.xml.stream,
diff --git a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java index 68815fc157..170a5259f3 100644 --- a/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java +++ b/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java @@ -30,6 +30,8 @@ import javax.wsdl.Binding; import javax.wsdl.Port; import javax.wsdl.PortType; import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap12.SOAP12Address; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; @@ -348,14 +350,25 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem if (service != null) { wsdlDefinition.setDefinition(service.getDefinition()); model.setService(service.getElement()); + + Port port = null; if (model.getPortName() != null) { - Port port = service.getElement().getPort(model.getPortName()); - if (port != null) { - model.setPort(port); - model.setBinding(port.getBinding()); - } else { - warning(monitor, "WsdlPortTypeDoesNotMatch", wsdlDefinition, model.getPortName()); + port = service.getElement().getPort(model.getPortName()); + } else { + // BWS20006 - no port specified so pick the first one + port = (Port)service.getElement().getPorts().values().iterator().next(); + } + + if (port != null) { + model.setPort(port); + model.setBinding(port.getBinding()); + + // if no URI specified set it from the WSDL port location + if (model.getURI() == null){ + model.setURI(getPortAddress(port)); } + } else { + error(monitor, "WsdlPortTypeDoesNotMatch", wsdlDefinition, model.getPortName()); } } else { error(monitor, "WsdlServiceDoesNotMatch", wsdlDefinition, model.getServiceName()); @@ -397,6 +410,17 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem } return portType; } + + public static String getPortAddress(Port port) { + Object ext = port.getExtensibilityElements().get(0); + if (ext instanceof SOAPAddress) { + return ((SOAPAddress)ext).getLocationURI(); + } + if (ext instanceof SOAP12Address) { + return ((SOAP12Address)ext).getLocationURI(); + } + return null; + } public QName getArtifactType() { return WebServiceConstants.BINDING_WS_QNAME; diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java index 82b3eaed1f..7af1451f68 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java @@ -19,6 +19,7 @@ package org.apache.tuscany.sca.builder.impl; +import java.net.URI; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -311,6 +312,23 @@ public class EndpointReferenceBuilderImpl { reference.getEndpointReferences().add(endpointRef); continue; } // end if + + // if it's an absolute URI then assume that it's a resolved binding + try { + URI tmpURI = new URI(uri); + if (tmpURI.isAbsolute()){ + // The user has configured a binding with an absolute URI so assume + // they know what they are doing and mark in as already resolved. + EndpointReference endpointRef = createEndpointRef(component, reference, binding, null, false); + endpointRef.setTargetEndpoint(createEndpoint(false)); + endpointRef.setStatus(EndpointReference.Status.RESOLVED_BINDING); + reference.getEndpointReferences().add(endpointRef); + continue; + } + } catch (Exception ex){ + // do nothing and go to the next bit of code + // which assumes that the URI is an SCA usi + } // The user has put something in the binding uri but we don't know if it's // a real URI or a target name. We can't tell until we have access to the |