axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r448864 - in /webservices/axis2/trunk/java/modules: java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java kernel/src/org/apache/axis2/deployment/util/Utils.java
Date Fri, 22 Sep 2006 08:30:50 GMT
Author: deepal
Date: Fri Sep 22 01:30:48 2006
New Revision: 448864

URL: http://svn.apache.org/viewvc?view=rev&rev=448864
Log:
fixing AXIS2-957

Modified:
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java?view=diff&rev=448864&r1=448863&r2=448864
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java
Fri Sep 22 01:30:48 2006
@@ -136,7 +136,7 @@
     private void generateTypes(OMFactory fac, OMElement defintions)
             throws Exception {
         OMElement wsdlTypes = fac.createOMElement("types", wsdl);
-                // wrap the Schema elements with this start and end tags to create a
+        // wrap the Schema elements with this start and end tags to create a
         // document root
         // under which the schemas can fall into
 
@@ -159,12 +159,12 @@
 
     private void generateMessages(OMFactory fac, OMElement definitions) {
         Hashtable namespaceMap = new Hashtable();
-        String namespacePrefix = null;
-        String namespaceURI = null;
-        QName messagePartType = null;
+        String namespacePrefix;
+        String namespaceURI;
+        QName messagePartType;
         for (int i = 0; i < method.length; i++) {
             JMethod jmethod = method[i];
-             if (!jmethod.isPublic()) {
+            if (!jmethod.isPublic()) {
                 continue;
             }
 
@@ -221,6 +221,31 @@
                         namespacePrefix + COLON_SEPARATOR
                                 + jmethod.getSimpleName() + RESPONSE, null);
             }
+
+            if (jmethod.getExceptionTypes().length > 0) {
+                if ((messagePartType = typeTable.getComplexSchemaType(jmethod.getSimpleName()
+ "Fault")) != null) {
+                    namespaceURI = messagePartType.getNamespaceURI();
+                    if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null)
{
+                        namespacePrefix = generatePrefix();
+                        namespaceMap.put(namespaceURI, namespacePrefix);
+                    }
+                    //Response Message
+                    OMElement responseMessge = fac.createOMElement(
+                            MESSAGE_LOCAL_NAME, wsdl);
+                    responseMessge.addAttribute(ATTRIBUTE_NAME, jmethod
+                            .getSimpleName()
+                            + "Fault", null);
+                    definitions.addChild(responseMessge);
+                    OMElement responsePart = fac.createOMElement(
+                            PART_ATTRIBUTE_NAME, wsdl);
+                    responseMessge.addChild(responsePart);
+                    responsePart.addAttribute(ATTRIBUTE_NAME, "part1", null);
+
+                    responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
+                            namespacePrefix + COLON_SEPARATOR
+                                    + jmethod.getSimpleName() + "Fault", null);
+                }
+            }
         }
 
         // now add these unique namespaces to the the definitions element
@@ -268,6 +293,15 @@
                         + RESPONSE_MESSAGE, null);
                 operation.addChild(message);
             }
+            if (jmethod.getExceptionTypes().length > 0) {
+                message = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
+                message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
+                        + COLON_SEPARATOR + jmethod.getSimpleName()
+                        + "Fault", null);
+                message.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName()
+                        + "Fault", null);
+                operation.addChild(message);
+            }
         }
 
     }
@@ -341,6 +375,14 @@
                         "namespace", targetNamespace);
                 operation.addChild(output);
             }
+
+            if (jmethod.getExceptionTypes().length > 0) {
+
+                OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
+                addExtensionElement(fac, fault, soap, SOAP_BODY, SOAP_USE, use,
+                        "namespace", targetNamespace);
+                operation.addChild(fault);
+            }
         }
     }
 
@@ -381,6 +423,13 @@
                 addExtensionElement(fac, output, soap12, SOAP_BODY, SOAP_USE, use,
                         "namespace", targetNamespace);
                 operation.addChild(output);
+            }
+             if (jmethod.getExceptionTypes().length > 0) {
+
+                OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
+                addExtensionElement(fac, fault, soap12, SOAP_BODY, SOAP_USE, use,
+                        "namespace", targetNamespace);
+                operation.addChild(fault);
             }
         }
     }

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java?view=diff&rev=448864&r1=448863&r2=448864
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java
Fri Sep 22 01:30:48 2006
@@ -53,6 +53,7 @@
     String ATTRIBUTE_NAME = "name";
     String REQUEST_MESSAGE = "RequestMessage";
     String RESPONSE_MESSAGE = "ResponseMessage";
+    String FAULT_MESSAGE = "Message";
     String MESSAGE_SUFFIX = "Message";
     String REQUEST = "Request";
     String RESPONSE = "Response";

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=448864&r1=448863&r2=448864
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Fri Sep 22 01:30:48 2006
@@ -299,6 +299,12 @@
                             Java2WSDLConstants.RESPONSE));
                     outMessage.setName(opName + Java2WSDLConstants.RESPONSE);
                 }
+                if (jmethod.getExceptionTypes().length > 0) {
+                    AxisMessage faultMessage = new AxisMessage();
+                    faultMessage.setName(jmethod.getSimpleName() + "Fault");
+                    faultMessage.setElementQName(table.getComplexSchemaType(jmethod.getSimpleName()
+ "Fault"));
+                    operation.setFaultMessages(faultMessage);
+                }
             } else {
                 operation = getAxisOperationforJmethod(jmethod, table);
                 MessageReceiver mr = axisService.getMessageReceiver(



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message