airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patanac...@apache.org
Subject svn commit: r1182012 - in /incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api: impl/JCRRegistry.java util/ util/WebServiceUtil.java
Date Tue, 11 Oct 2011 18:33:03 GMT
Author: patanachai
Date: Tue Oct 11 18:33:02 2011
New Revision: 1182012

URL: http://svn.apache.org/viewvc?rev=1182012&view=rev
Log:
AIRAVATA-137 Change Util class name and fix close tag bug

Added:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java
Modified:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java?rev=1182012&r1=1182011&r2=1182012&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
(original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
Tue Oct 11 18:33:02 2011
@@ -58,7 +58,7 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.registry.api.exception.ServiceDescriptionRetrieveException;
 import org.apache.airavata.registry.api.user.UserManager;
 import org.apache.airavata.registry.api.user.UserManagerFactory;
-import org.apache.airavata.registry.api.util.Axis2Util;
+import org.apache.airavata.registry.api.util.WebServiceUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -521,7 +521,7 @@ public class JCRRegistry implements Axis
     }
 
     public String saveWSDL(ServiceDescription service) {
-        return saveWSDL(service, Axis2Util.generateWSDL(service));
+        return saveWSDL(service, WebServiceUtil.generateWSDL(service));
     }
 
     public String getWSDL(String serviceName) {

Added: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java?rev=1182012&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java
(added)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java
Tue Oct 11 18:33:02 2011
@@ -0,0 +1,82 @@
+package org.apache.airavata.registry.api.util;
+
+import org.apache.airavata.commons.gfac.type.Parameter;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+
+public class WebServiceUtil {
+
+    public static String generateWSDL(ServiceDescription service) {
+        StringBuilder builder = new StringBuilder();
+        builder.append("<wsdl:definitions xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\"
xmlns:ns1=\"http://org.apache.axis2/xsd\" xmlns:ns=\"http://www.wso2.org/types\" xmlns:wsaw=\"http://www.w3.org/2006/05/addressing/wsdl\"
xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"
xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:mime=\"http://schemas.xmlsoap.org/wsdl/mime/\"
xmlns:soap12=\"http://schemas.xmlsoap.org/wsdl/soap12/\" targetNamespace=\"http://www.wso2.org/types\">");
+        builder.append("<wsdl:documentation>");
+        builder.append(service.getId());
+        builder.append("</wsdl:documentation>");
+        builder.append("<wsdl:types>");
+        builder.append("<xs:schema attributeFormDefault=\"qualified\" elementFormDefault=\"unqualified\"
targetNamespace=\"http://www.wso2.org/types\">");
+
+        if (service.getInputParameters() != null && service.getInputParameters().size()
> 0) {
+            builder.append("<xs:element name=\"invoke\">");
+            builder.append("<xs:complexType>");
+            builder.append("<xs:sequence>");
+
+            for (Parameter parameter : service.getInputParameters()) {
+                generateElementFromType(parameter, builder);
+            }
+
+            builder.append("</xs:sequence>");
+            builder.append("</xs:complexType>");
+            builder.append("</xs:element>");
+        }
+
+        if (service.getOutputParameters() != null && service.getOutputParameters().size()
> 0) {
+            builder.append("<xs:element name=\"invokeResponse\">");
+            builder.append("<xs:complexType>");
+            builder.append("<xs:sequence>");
+
+            for (Parameter parameter : service.getOutputParameters()) {
+                generateElementFromType(parameter, builder);
+            }
+
+            builder.append("</xs:sequence>");
+            builder.append("</xs:complexType>");
+            builder.append("</xs:element>");
+        }
+
+        builder.append("</xs:schema>");
+        builder.append("</wsdl:types>");
+
+        builder.append("<wsdl:message name=\"invokeRequest\">");
+        builder.append("<wsdl:part name=\"parameters\" element=\"ns:invoke\"/>");
+        builder.append("</wsdl:message>");
+        builder.append("<wsdl:message name=\"invokeResponse\">");
+        builder.append("<wsdl:part name=\"parameters\" element=\"ns:invokeResponse\"/>");
+        builder.append("</wsdl:message>");
+
+        builder.append("<wsdl:portType name=\"");
+        builder.append(service.getId());
+        builder.append("\">");
+        builder.append("<wsdl:operation name=\"invoke\">");
+        builder.append("<wsdl:input message=\"ns:invokeRequest\" wsaw:Action=\"urn:invoke\"/>");
+        builder.append("<wsdl:output message=\"ns:invokeResponse\" wsaw:Action=\"urn:invokeResponse\"/>");
+        builder.append("</wsdl:operation>");
+        builder.append("</wsdl:portType>");
+
+        builder.append("</wsdl:definitions>");
+
+        return builder.toString();
+    }
+
+    private static void generateElementFromType(Parameter parameter, StringBuilder builder)
{
+        switch (parameter.getType()) {
+        case String:
+            builder.append("<xs:element minOccurs=\"0\" name=\"");
+            builder.append(parameter.getName());
+            builder.append("\" nillable=\"true\" type=\"xs:string\"/>");
+            break;
+        default:
+            break;
+        }
+
+    }
+
+}



Mime
View raw message