tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r956539 - in /tuscany/sca-java-2.x/trunk/modules: binding-ws/META-INF/ binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/ builder/src/main/java/org/apache/tuscany/sca/builder/impl/
Date Mon, 21 Jun 2010 11:59:58 GMT
Author: slaws
Date: Mon Jun 21 11:59:57 2010
New Revision: 956539

URL: http://svn.apache.org/viewvc?rev=956539&view=rev
Log:
BWS20006 - if a component reference binding.ws names a WSDL service with more than one port
then pick the first port. 

Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-ws/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
    tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws/META-INF/MANIFEST.MF?rev=956539&r1=956538&r2=956539&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws/META-INF/MANIFEST.MF Mon Jun 21 11:59:57
2010
@@ -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,

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java?rev=956539&r1=956538&r2=956539&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
Mon Jun 21 11:59:57 2010
@@ -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 
                 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 
         }
         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;

Modified: tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java?rev=956539&r1=956538&r2=956539&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
Mon Jun 21 11:59:57 2010
@@ -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 EndpointReferenceBuilderImp
                         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 



Mime
View raw message