Author: asankha
Date: Tue May 22 05:08:14 2007
New Revision: 540550

URL: http://svn.apache.org/viewvc?view=rev&rev=540550
Log:
more robust error handling
support wsdl 2.0 generation with a supplied wsdl 1.1 (overcoming axis2 1.2 
known issue)


Modified:
    
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
    
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
    
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java?view=diff&rev=540550&r1=540549&r2=540550
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
 Tue May 22 05:08:14 2007
@@ -228,14 +228,20 @@
      * @return its value
      */
     public Entry getEntryDefinition(String key) {
-        Entry entry = (Entry) localRegistry.get(key);
-        if (entry == null) {
-            // this is not a local definition
-            entry = new Entry(key);
-            entry.setType(Entry.REMOTE_ENTRY);
-            addEntry(key, entry);
+        Object o = localRegistry.get(key);
+        if (o instanceof Entry) {
+            Entry entry = (Entry) o;
+            if (entry == null) {
+                // this is not a local definition
+                entry = new Entry(key);
+                entry.setType(Entry.REMOTE_ENTRY);
+                addEntry(key, entry);
+            }
+            return entry;
+        } else {
+            handleException("Invalid local registry entry : " + key);
+            return null;
         }
-        return entry;
     }
 
     /**

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java?view=diff&rev=540550&r1=540549&r2=540550
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
 Tue May 22 05:08:14 2007
@@ -97,7 +97,8 @@
                     }
 
                 } catch (NumberFormatException e) {
-                    handleException("suspendDuratiOnFailure should be valid 
number.");
+                    handleException("The suspend duration should be specified 
as a valid number :: "
+                        + e.getMessage(), e);
                 }
             }
         }
@@ -216,8 +217,15 @@
             if (duration != null) {
                 String d = duration.getText();
                 if (d != null) {
-                    long timeoutSeconds = new Long(d.trim()).longValue();
-                    endpoint.setTimeoutDuration(timeoutSeconds * 1000);
+                    try {
+                        long timeoutSeconds = new Long(d.trim()).longValue();
+                        endpoint.setTimeoutDuration(timeoutSeconds * 1000);
+                        
+                    } catch (NumberFormatException e) {
+                        handleException(
+                            "The timeout seconds should be specified as a 
valid number :: "
+                            + e.getMessage(), e);
+                    }
                 }
             }
 

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java?view=diff&rev=540550&r1=540549&r2=540550
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
 Tue May 22 05:08:14 2007
@@ -216,6 +216,7 @@
                 try {
                     // detect version of the WSDL 1.1 or 2.0
                     if (wsdlNamespace != null) {
+                        boolean isWSDL11 = false;
                         WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = 
null;
                         if (WSDL2Constants.WSDL_NAMESPACE.
                                 equals(wsdlNamespace.getNamespaceURI())) {
@@ -227,6 +228,7 @@
                                 equals(wsdlNamespace.getNamespaceURI())) {
                             wsdlToAxisServiceBuilder =
                                     new 
WSDL11ToAxisServiceBuilder(wsdlInputStream, null, null);
+                            isWSDL11 = true;
                         } else {
                             handleException("Unknown WSDL format.. not WSDL 
1.1 or WSDL 2.0");
                         }
@@ -237,6 +239,23 @@
                         }
                         proxyService = 
wsdlToAxisServiceBuilder.populateService();
                         proxyService.setWsdlFound(true);
+
+                        if (isWSDL11) {
+                            // workaround to support WSDL 2.0 generation when 
only a WSDL 1.1
+                            // is supplied
+                            Collection endpoints = 
proxyService.getEndpoints().values();
+                            Iterator iter = endpoints.iterator();
+                            while (iter.hasNext()) {
+                                AxisEndpoint endpoint = (AxisEndpoint) 
iter.next();
+                                Iterator children = 
endpoint.getBinding().getChildren();
+                                while (children.hasNext()) {
+                                    AxisBindingOperation axisBindingOperation =
+                                        (AxisBindingOperation) children.next();
+                                    axisBindingOperation.setProperty(
+                                        
WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED, new Boolean(false));
+                                }
+                            }
+                        }
 
                     } else {
                         handleException("Unknown WSDL format.. not WSDL 1.1 or 
WSDL 2.0");



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to