axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r543706 - in /webservices/axis2/trunk/java/modules: codegen/test/org/apache/axis2/wsdl/ integration/test/org/apache/axis2/engine/ java2wsdl/src/org/apache/ws/java2wsdl/ kernel/src/org/apache/axis2/dataretrieval/ kernel/src/org/apache/axis2/...
Date Sat, 02 Jun 2007 04:51:17 GMT
Author: dims
Date: Fri Jun  1 21:51:16 2007
New Revision: 543706

URL: http://svn.apache.org/viewvc?view=rev&rev=543706
Log:
- Rename classes to actually reflect that they generate WSDL (and it's version)
- Consolidate duplicate code (printUserWSDL)
- Don't pass in values via AxisService2XYZ constructor that are not really used inside the
class


Added:
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL11.java
  (contents, props changed)
      - copied, changed from r543493, webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
  (contents, props changed)
      - copied, changed from r543493, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
  (contents, props changed)
      - copied, changed from r543493, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
Removed:
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
Modified:
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/WSDLDataLocator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java

Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java?view=diff&rev=543706&r1=543705&r2=543706
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java
Fri Jun  1 21:51:16 2007
@@ -70,13 +70,9 @@
                         configContext.getAxisConfiguration().addService(service);
                         OutputStream out =
                                 new FileOutputStream(new File(outLocation, file1.getName()));
-                        service.printWSDL(out, "http://google.com/axis2/services", "services");
+                        service.printWSDL(out, "http://google.com/axis2/services");
                         out.flush();
                         out.close();
-//                        URL wsdlURL = new URL("http://localhost:" + 6060 +
-//                                "/axis2/services/" + service.getName() + "?wsdl");
-//                        builder = new WSDL11ToAxisServiceBuilder(wsdlURL.openStream(),
null, null);
-//                        service = builder.populateService();
                         configContext.getAxisConfiguration().removeService(service.getName());
                     } catch (Exception e) {
                         System.out.println("Error in WSDL : " + file1.getName());

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java?view=diff&rev=543706&r1=543705&r2=543706
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java
Fri Jun  1 21:51:16 2007
@@ -66,7 +66,7 @@
         assertNotNull(messge.getSchemaElement());
         assertNotNull(service.getOperation(new QName("putValue")));
         assertNotNull(axisConfig.getService("MyService"));
-        service.printWSDL(System.out, null, "services");
+        service.printWSDL(System.out);
 
         RPCServiceClient client = new RPCServiceClient(clinetConfigurationctx, null);
 

Copied: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL11.java
(from r543493, 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/Java2WSDL11.java?view=diff&rev=543706&p1=webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java&r1=543493&p2=webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL11.java&r2=543706
==============================================================================
--- 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/Java2WSDL11.java
Fri Jun  1 21:51:16 2007
@@ -37,7 +37,7 @@
 *
 */
 
-public class Java2OMBuilder implements Java2WSDLConstants {
+public class Java2WSDL11 implements Java2WSDLConstants {
 
     private TypeTable typeTable = null;
 
@@ -73,7 +73,7 @@
 
     private String locationURL;
 
-    public Java2OMBuilder(JMethod[] method, Collection schemaCollection,
+    public Java2WSDL11(JMethod[] method, Collection schemaCollection,
                           TypeTable typeTab, String serviceName, String targetNamespace,
                           String targetNamespacePrefix, String style, String use,
                           String locationURL) {

Propchange: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL11.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?view=diff&rev=543706&r1=543705&r2=543706
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
Fri Jun  1 21:51:16 2007
@@ -170,7 +170,7 @@
 
         Collection schemaCollection = schemaGenerator.generateSchema();
         
-        Java2OMBuilder java2OMBuilder = new Java2OMBuilder(schemaGenerator.getMethods(),
+        Java2WSDL11 java2WSDL11 = new Java2WSDL11(schemaGenerator.getMethods(),
                 schemaCollection,
                 schemaGenerator.getTypeTable(),
                 serviceName == null ? Java2WSDLUtils.getSimpleClassName(className) : serviceName,
@@ -179,9 +179,9 @@
                 style,
                 use,
                 locationUri);
-        java2OMBuilder.setSchemaTargetNamespace(getSchemaTargetNamespace());
-        java2OMBuilder.setSchemaTargetNamespacePrefix(getSchemaTargetNamespacePrefix());
-        OMElement wsdlElement = java2OMBuilder.generateOM();
+        java2WSDL11.setSchemaTargetNamespace(getSchemaTargetNamespace());
+        java2WSDL11.setSchemaTargetNamespacePrefix(getSchemaTargetNamespacePrefix());
+        OMElement wsdlElement = java2WSDL11.generateOM();
         if(!isPretty()){
             wsdlElement.serialize(out);
         } else {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/WSDLDataLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/WSDLDataLocator.java?view=diff&rev=543706&r1=543705&r2=543706
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/WSDLDataLocator.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/WSDLDataLocator.java
Fri Jun  1 21:51:16 2007
@@ -19,7 +19,7 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisService2OM;
+import org.apache.axis2.description.AxisService2WSDL11;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -118,17 +118,11 @@
                 throw new DataRetrievalException("MessageContext was not set!");
             }
 
-            AxisService2OM axisService2WOM;
+            AxisService2WSDL11 axisService2WOM;
             OMElement wsdlElement;
 
             try {
-                String[] exposedEPRs = theService.getEPRs();
-                if (exposedEPRs == null) {
-                    exposedEPRs = new String[]{theService.getEndpointName()};
-                }
-                axisService2WOM = new AxisService2OM(theService,
-                                                     exposedEPRs, "document", "literal",
-                                                     "");
+                axisService2WOM = new AxisService2WSDL11(theService);
                 wsdlElement = axisService2WOM.generateOM();
             }
             catch (Exception e) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=543706&r1=543705&r2=543706
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
Fri Jun  1 21:51:16 2007
@@ -821,35 +821,6 @@
         return null;
     }
 
-    /**
-     * @param out
-     * @param requestIP
-     * @param servicePath
-     * @throws AxisFault
-     */
-    public void printWSDL(OutputStream out, String requestIP, String servicePath) throws
AxisFault {
-        if (isUseUserWSDL()) {
-            Parameter wsld4jdefinition = getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
-            if (wsld4jdefinition != null) {
-                try {
-                    Definition definition = (Definition) wsld4jdefinition.getValue();
-                    if (isModifyUserWSDLPortAddress()) {
-                        setPortAddress(definition);
-                    }
-                    WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
-                    writer.writeWSDL(definition, out);
-                } catch (WSDLException e) {
-                    throw AxisFault.makeFault(e);
-                }
-            } else {
-                printWSDLError(out);
-            }
-        } else {
-            String[] eprArray = getEPRs(requestIP);
-            getWSDL(out, eprArray);
-        }
-    }
-
     public String[] getEPRs() throws AxisFault {
         String requestIP;
         try {
@@ -919,14 +890,36 @@
         return (String[]) eprList.toArray(new String[eprList.size()]);
     }
 
+    private void printUserWSDL(OutputStream out) throws AxisFault {
+        Parameter wsld4jdefinition = getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
+        if (wsld4jdefinition != null) {
+            try {
+                Definition definition = (Definition) wsld4jdefinition.getValue();
+                if (isModifyUserWSDLPortAddress()) {
+                    setPortAddress(definition);
+                }
+                WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
+                writer.writeWSDL(definition, out);
+            } catch (WSDLException e) {
+                throw AxisFault.makeFault(e);
+            }
+        } else {
+            printWSDLError(out);
+        }
+    }
+
     /**
      * @param out
      * @param requestIP
      * @throws AxisFault
-     * @deprecated try to use the method which takes three arguments
      */
     public void printWSDL(OutputStream out, String requestIP) throws AxisFault {
-        printWSDL(out, requestIP, "services");
+        if (isUseUserWSDL()) {
+            printUserWSDL(out);
+        } else {
+            String[] eprArray = getEPRs(requestIP);
+            getWSDL(out, eprArray);
+        }
     }
 
     /**
@@ -937,21 +930,7 @@
      */
     public void printWSDL(OutputStream out) throws AxisFault {
         if (isUseUserWSDL()) {
-            Parameter wsld4jdefinition = getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
-            if (wsld4jdefinition != null) {
-                try {
-                    Definition definition = (Definition) wsld4jdefinition.getValue();
-                    if (isModifyUserWSDLPortAddress()) {
-                        setPortAddress(definition);
-                    }
-                    WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
-                    writer.writeWSDL(definition, out);
-                } catch (WSDLException e) {
-                    throw AxisFault.makeFault(e);
-                }
-            } else {
-                printWSDLError(out);
-            }
+            printUserWSDL(out);
         } else {
             setWsdlFound(true);
             //pick the endpointName and take it as the epr for the WSDL
@@ -1026,20 +1005,9 @@
 
     //WSDL 2.0
     public void printWSDL2(OutputStream out) throws AxisFault {
-        // Woden has not implemented the serializer yet, so all we can do it serialize the
axisService
-            getWSDL2(out, new String[]{this.endpointName});
-        }
-
-    public void printWSDL2(OutputStream out,
-                           String requestIP,
-                           String servicePath) throws AxisFault {
-        getWSDL2(out, getEPRs());
-    }
-
-    private void getWSDL2(OutputStream out, String[] serviceURL) throws AxisFault {
-        AxisService2WSDL2 axisService2WSDL2 = new AxisService2WSDL2(this, serviceURL);
+        AxisService2WSDL20 axisService2WSDL2 = new AxisService2WSDL20(this);
         try {
-            OMElement wsdlElement = axisService2WSDL2.toWSDL20();
+            OMElement wsdlElement = axisService2WSDL2.generateOM();
             wsdlElement.serialize(out);
             out.flush();
             out.close();

Copied: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
(from r543493, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?view=diff&rev=543706&p1=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java&r1=543493&p2=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java&r2=543706
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
Fri Jun  1 21:51:16 2007
@@ -50,7 +50,7 @@
  *
  */
 
-public class AxisService2OM implements Java2WSDLConstants {
+public class AxisService2WSDL11 implements Java2WSDLConstants {
 
     private AxisService axisService;
 
@@ -72,9 +72,9 @@
 
     private OMNamespace wsdl;
 
-    private String style;
+    private String style = DOCUMENT;
 
-    private String use;
+    private String use = LITERAL;
 
     private String servicePath;
 
@@ -84,26 +84,17 @@
 
     private HashMap messagesMap;
 
-    public AxisService2OM(AxisService service, String[] serviceEndpointURLs,
-                          String style, String use, String servicePath) {
+    public AxisService2WSDL11(AxisService service) throws Exception {
         this.axisService = service;
 
         // the EPR list of AxisService contains REST EPRs as well. Those REST EPRs will be
used to generated HTTPBinding
         // and rest of the EPRs will be used to generate SOAP 1.1 and 1.2 bindings. Let's
first initialize those set of
         // EPRs now to be used later, especially when we generate the WSDL.
-        this.serviceEndpointURLs = serviceEndpointURLs;
-
-        if (style == null) {
-            this.style = DOCUMENT;
-        } else {
-            this.style = style;
-        }
-        if (use == null) {
-            this.use = LITERAL;
-        } else {
-            this.use = use;
+        serviceEndpointURLs = service.getEPRs();
+        if (serviceEndpointURLs == null) {
+            serviceEndpointURLs = new String[]{service.getEndpointName()};
         }
-        this.servicePath = servicePath;
+
         this.targetNamespace = service.getTargetNamespace();
 
         serializer = new ExternalPolicySerializer();

Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
(from r543493, webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?view=diff&rev=543706&p1=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java&r1=543493&p2=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java&r2=543706
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
Fri Jun  1 21:51:16 2007
@@ -23,23 +23,20 @@
 import java.util.Iterator;
 import java.util.Map;
 
-public class AxisService2WSDL2 implements WSDL2Constants {
+public class AxisService2WSDL20 implements WSDL2Constants {
 
     private AxisService axisService;
 
-    private String[] url;
-
-    public AxisService2WSDL2(AxisService service, String[] serviceURL) {
+    public AxisService2WSDL20(AxisService service) {
         this.axisService = service;
-        url = serviceURL;
     }
 
     /**
      * Generates a WSDL 2.0 document for this web service
      * @return The WSDL2 document element
-     * @throws org.apache.axis2.AxisFault - Thrown in case an exception occurs
+     * @throws Exception - Thrown in case an exception occurs
      */
-    public OMElement toWSDL20() throws AxisFault {
+    public OMElement generateOM() throws Exception {
 
         Map nameSpacesMap = axisService.getNameSpacesMap();
         OMFactory omFactory = OMAbstractFactory.getOMFactory();

Propchange: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=543706&r1=543705&r2=543706
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
Fri Jun  1 21:51:16 2007
@@ -103,10 +103,9 @@
                 HashMap services = configurationContext.getAxisConfiguration().getServices();
                 AxisService service = (AxisService) services.get(serviceName);
                 if (service != null) {
-                    String ip = getHostAddress(request);
                     response.setStatus(HttpStatus.SC_OK);
                     response.setContentType("text/xml");
-                    service.printWSDL2(response.getOutputStream(), ip, servicePath);
+                    service.printWSDL2(response.getOutputStream());
                     return;
                 }
             }
@@ -115,10 +114,9 @@
                 HashMap services = configurationContext.getAxisConfiguration().getServices();
                 AxisService service = (AxisService) services.get(serviceName);
                 if (service != null) {
-                    String ip = getHostAddress(request);
                     response.setStatus(HttpStatus.SC_OK);
                     response.setContentType("text/xml");
-                    service.printWSDL(response.getOutputStream(), ip, servicePath);
+                    service.printWSDL(response.getOutputStream());
                     return;
                 }
             }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java?view=diff&rev=543706&r1=543705&r2=543706
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
Fri Jun  1 21:51:16 2007
@@ -210,7 +210,7 @@
                     res.setContentType("text/xml");
                     String ip = extractHostAndPort(filePart, isHttp);
                     ((AxisService) serviceObj)
-                            .printWSDL2(out, ip, configContext.getServiceContextPath());
+                            .printWSDL2(out);
                     out.flush();
                     out.close();
                     return;
@@ -218,7 +218,7 @@
                     OutputStream out = res.getOutputStream();
                     res.setContentType("text/xml");
                     String ip = extractHostAndPort(filePart, isHttp);
-                    ((AxisService) serviceObj).printWSDL(out, ip, configContext.getServicePath());
+                    ((AxisService) serviceObj).printWSDL(out, ip);
                     out.flush();
                     out.close();
                     return;



---------------------------------------------------------------------
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