You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/01/06 11:35:54 UTC

svn commit: r366470 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/deployment/util/ core/src/org/apache/axis2/description/ core/src/org/apache/axis2/engine/ webapp/

Author: deepal
Date: Fri Jan  6 02:35:39 2006
New Revision: 366470

URL: http://svn.apache.org/viewcvs?rev=366470&view=rev
Log:
When we creating AxisService programatically its operations do not have correct phase chains , and at the deployment time the default phases chains will be stored in AxisConfiguration , so when adding service into AxisConfig , if the handler chains are not there in the service then the default phase chains will be added to the operations.

- integrate ServiceClient into happy axis

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=366470&r1=366469&r2=366470&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java Fri Jan  6 02:35:39 2006
@@ -28,12 +28,7 @@
 import org.apache.axis2.deployment.scheduler.SchedulerTask;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.Flow;
-import org.apache.axis2.description.ModuleDescription;
-import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.Phase;
 import org.apache.axis2.i18n.Messages;
@@ -44,19 +39,8 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+import java.io.*;
+import java.util.*;
 
 public class DeploymentEngine implements DeploymentConstants {
 
@@ -193,6 +177,7 @@
 
         while (services.hasNext()) {
             AxisService axisService = (AxisService) services.next();
+            axisService.setUseDefaultChains(false);
 
             axisService.setFileName(currentArchiveFile.getFile().getAbsolutePath());
             serviceGroup.addService(axisService);
@@ -319,8 +304,8 @@
 
     /**
      * Fills an axisservice object using services.xml. First creates
-     * an axisservice object using WSDL and then fills it using the given services.xml. 
-     * Loads all the required class and builds the chains, finally adds the  
+     * an axisservice object using WSDL and then fills it using the given services.xml.
+     * Loads all the required class and builds the chains, finally adds the
      * servicecontext to EngineContext and axisservice into EngineConfiguration.
      *
      * @param axisService

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java?rev=366470&r1=366469&r2=366470&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java Fri Jan  6 02:35:39 2006
@@ -222,6 +222,7 @@
                                             AxisConfiguration axisConfig) throws AxisFault {
         Parameter parameter = new ParameterImpl(Constants.SERVICE_CLASS, implClass);
         AxisService axisService = new AxisService();
+        axisService.setUseDefaultChains(false);
         axisService.addParameter(parameter);
 
         int index = implClass.lastIndexOf(".");

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=366470&r1=366469&r2=366470&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Fri Jan  6 02:35:39 2006
@@ -42,11 +42,7 @@
 import javax.xml.namespace.QName;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
+import java.util.*;
 
 /**
  * Class AxisService
@@ -87,10 +83,13 @@
 
     //to store default message receivers
     private HashMap messageReceivers;
-    
+
     // to store policies which are valid for the entire service
     private PolicyInclude policyInclude;
 
+// to set the handler chain available in phase info
+    private boolean useDefaultChains = true;
+
     /**
      * Constructor AxisService.
      */
@@ -308,13 +307,13 @@
     }
 
     public void printWSDL(OutputStream out, String serviceURL) throws AxisFault {
-        if(getWSDLDefinition() != null) {
-            printUsingWSDLDefinition(out, serviceURL);    
+        if (getWSDLDefinition() != null) {
+            printUsingWSDLDefinition(out, serviceURL);
         } else {
-            printUsingWOM(out, serviceURL);    
+            printUsingWOM(out, serviceURL);
         }
     }
-    
+
     public void printUsingWSDLDefinition(OutputStream out, String serviceURL) throws AxisFault {
         try {
             Definition wsdlDefinition = getWSDLDefinition();
@@ -352,11 +351,11 @@
         AxisService2WOM axisService2WOM = new AxisService2WOM(getSchema(), this, null, null, serviceURL);
         try {
             WSDLDescription desc = axisService2WOM.generateWOM();
-            
+
             // populate it with policy information ..
             //TODO : This gives an NPE , Sanka pls fix that
             PolicyUtil.populatePolicy(desc, this);
-            
+
             WOMWriter womWriter = WOMWriterFactory.createWriter(WSDLConstants.WSDL_1_1);
             womWriter.setdefaultWSDLPrefix("wsdl");
             womWriter.writeWOM(desc, out);
@@ -649,12 +648,20 @@
             this.scope = scope;
         }
     }
-    
+
     public void setPolicyInclude(PolicyInclude policyInclude) {
         this.policyInclude = policyInclude;
     }
-    
+
     public PolicyInclude getPolicyInclude() {
         return policyInclude;
+    }
+
+    public boolean isUseDefaultChains() {
+        return useDefaultChains;
+    }
+
+    public void setUseDefaultChains(boolean useDefaultChains) {
+        this.useDefaultChains = useDefaultChains;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java?rev=366470&r1=366469&r2=366470&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java Fri Jan  6 02:35:39 2006
@@ -23,17 +23,7 @@
 import org.apache.axis2.deployment.DeploymentEngine;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.ModuleConfiguration;
-import org.apache.axis2.description.ModuleDescription;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.ParameterInclude;
-import org.apache.axis2.description.ParameterIncludeImpl;
-import org.apache.axis2.description.PolicyInclude;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.*;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
 import org.apache.axis2.receivers.RawXMLINOutMessageReceiver;
@@ -44,12 +34,7 @@
 
 import javax.xml.namespace.QName;
 import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 
 /**
  * Class AxisConfigurationImpl
@@ -223,6 +208,13 @@
 
         while (services.hasNext()) {
             description = (AxisService) services.next();
+            if (description.isUseDefaultChains()) {
+                Iterator operations = description.getOperations().values().iterator();
+                while (operations.hasNext()) {
+                    AxisOperation operation = (AxisOperation) operations.next();
+                    phasesinfo.setOperationPhases(operation);
+                }
+            }
             allservices.put(description.getName(), description);
             notifyObservers(AxisEvent.SERVICE_DEPLOY, description);
         }

Modified: webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp?rev=366470&r1=366469&r2=366470&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp (original)
+++ webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp Fri Jan  6 02:35:39 2006
@@ -2,8 +2,8 @@
 <%@ page import="org.apache.axis2.AxisFault,
                  org.apache.axis2.Constants,
                  org.apache.axis2.addressing.EndpointReference,
-                 org.apache.axis2.client.Call,
                  org.apache.axis2.client.Options,
+                 org.apache.axis2.client.ServiceClient,
                  org.apache.axis2.om.OMAbstractFactory,
                  org.apache.axis2.om.OMElement,
                  org.apache.axis2.om.OMFactory,
@@ -12,16 +12,15 @@
                  javax.servlet.http.HttpServletRequest,
                  javax.servlet.http.HttpServletResponse,
                  javax.servlet.jsp.JspWriter,
-                 javax.xml.namespace.QName"
+                 javax.xml.parsers.SAXParser"
          session="false" %>
-<%@ page import="javax.xml.parsers.SAXParser" %>
 <%@ page import="javax.xml.parsers.SAXParserFactory" %>
 <%@ page import="javax.xml.stream.XMLOutputFactory" %>
 <%@ page import="javax.xml.stream.XMLStreamException" %>
 <%@ page import="java.io.IOException" %>
-
 <%@ page import="java.io.InputStream" %>
-<%@ page import="java.io.StringWriter"%>
+
+<%@ page import="java.io.StringWriter" %>
 
 <%
     /*
@@ -328,7 +327,6 @@
     }
 
     private String value;
-    private QName operationName = new QName("getVersion");
 
     private OMElement createEnvelope() {
         OMFactory fac = OMAbstractFactory.getOMFactory();
@@ -342,14 +340,13 @@
     public boolean inVokeTheService() {
         try {
             OMElement payload = createEnvelope();
-            Call call = new Call();
+            ServiceClient client = new ServiceClient();
             Options options = new Options();
-            call.setClientOptions(options);
+            client.setOptions(options);
             options.setTo(targetEPR);
             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
 
-            OMElement result =
-                    call.invokeBlocking(operationName.getLocalPart(), payload);
+            OMElement result = client.sendReceive(payload);
             StringWriter writer = new StringWriter();
             result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
             writer.flush();