You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2005/01/26 15:59:40 UTC

svn commit: r126506 - in webservices/axis/trunk/java/dev/scratch/prototype2/src: java/org/apache/axis/deployment java/org/apache/axis/encoding java/org/apache/axis/engine java/org/apache/axis/impl/llom java/org/apache/axis/impl/llom/builder java/org/apache/axis/impl/providers java/org/apache/axis/impl/transport/http java/org/apache/axis/om test/org/apache/axis/deployment

Author: ajith
Date: Wed Jan 26 06:59:38 2005
New Revision: 126506

URL: http://svn.apache.org/viewcvs?view=rev&rev=126506
Log:
Added to improve the functionality to handle string arrays. By me and Srinath
Modified:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectImpl.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMConstants.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/DeploymentotalTest.java

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java	Wed Jan 26 06:59:38 2005
@@ -251,7 +251,6 @@
                     throw new RuntimeException("file not found !!!!!!!!!!!!!!!");
                 }
                 urlsToLoadFrom = new URL[]{file.toURL()};
-                System.out.println("urlsToLoadFrom = " + file.getAbsolutePath());
                 loader1 = new URLClassLoader(urlsToLoadFrom, parent);
                 service.setClassLoader(loader1);
                 if(! currentFileItem.getClassName().equals("")){

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectImpl.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectImpl.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectImpl.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectImpl.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectImpl.java	Wed Jan 26 06:59:38 2005
@@ -17,6 +17,7 @@
 
 import org.apache.axis.om.OMException;
 import org.apache.axis.om.OutObject;
+import org.apache.axis.om.OMConstants;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
@@ -43,6 +44,16 @@
             }else if(obj instanceof Integer){
                 char[] str = obj.toString().toCharArray();
                 cHandler.characters(str,0,str.length);
+            }else if(obj instanceof String[]){
+                String[] strs = (String[])obj;
+                char[] str = null;
+                for (int i = 0; i < strs.length; i++) {
+                    cHandler.startElement(OMConstants.ARRAY_ITEM_NSURI,OMConstants.ARRAY_ITEM_LOCALNAME,"",null);
+                    str = strs[i].toCharArray();
+                    cHandler.characters(str,0,str.length);
+                    cHandler.endElement(OMConstants.ARRAY_ITEM_NSURI,OMConstants.ARRAY_ITEM_LOCALNAME,"");
+                }
+
             }else{
                 throw new OMException("Unsupported type");
             }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java	Wed Jan 26 06:59:38 2005
@@ -75,6 +75,7 @@
         MessageContext context,
         AxisFault e)
         throws AxisFault {
+        e.printStackTrace();
         boolean serverSide = context.isServerSide();
         if(serverSide && !context.isProcessingFault()){    
             AxisService service = context.getService();

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java	Wed Jan 26 06:59:38 2005
@@ -38,7 +38,7 @@
             int serviceIndex = 0;
             if((serviceIndex = filePart.indexOf(pattern)) > 0){
                 uri = filePart.substring(serviceIndex + pattern.length());
-                System.out.println(uri);
+
             }
 
             QName serviceName = null;

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java	Wed Jan 26 06:59:38 2005
@@ -488,7 +488,7 @@
         if (ns != null) {
             prefix = ns.getPrefix();
             nameSpaceName = ns.getName();
-            if (prefix != null) {
+            if (prefix != null && nameSpaceName != null) {
                 writer.writeStartElement(prefix, this.getLocalName(), nameSpaceName);
                 if (serializeNamespace(ns, writer)) nsPushCount++;
             } else {

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java	Wed Jan 26 06:59:38 2005
@@ -195,20 +195,22 @@
         String attrUri = "";
         String attrPrefix = "";
         OMNamespace ns = null;
-        for (int i = 0; i < atts.getLength(); i++) {
+        if(atts != null){
+            for (int i = 0; i < atts.getLength(); i++) {
 
-            attrUri = atts.getURI(i);
-            String attrQName = atts.getQName(i);
-            attrPrefix = (attrQName.indexOf(':') >= 0) ? attrQName.substring(0, attrQName.indexOf(':')) : "";
+                attrUri = atts.getURI(i);
+                String attrQName = atts.getQName(i);
+                attrPrefix = (attrQName.indexOf(':') >= 0) ? attrQName.substring(0, attrQName.indexOf(':')) : "";
 
-            if (attrUri.hashCode() != 0)
-                ns = element.findInScopeNamespace(attrUri, attrPrefix);
+                if (attrUri.hashCode() != 0)
+                    ns = element.findInScopeNamespace(attrUri, attrPrefix);
 
-            if (ns == null)
-            //todo this needs to be fixed!!!!!
-            // throw new OMException("All elements must be namespace qualified!");
+                if (ns == null)
+                //todo this needs to be fixed!!!!!
+                // throw new OMException("All elements must be namespace qualified!");
 
-                element.insertAttribute(atts.getLocalName(i), atts.getValue(i), ns);
+                    element.insertAttribute(atts.getLocalName(i), atts.getValue(i), ns);
+            }
         }
 
         element.setComplete(false);

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java	Wed Jan 26 06:59:38 2005
@@ -33,13 +33,7 @@
 import org.apache.axis.engine.Provider;
 import org.apache.axis.impl.description.AxisService;
 import org.apache.axis.impl.llom.builder.ObjectToOMBuilder;
-import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMFactory;
-import org.apache.axis.om.OMNamespace;
-import org.apache.axis.om.OMNode;
-import org.apache.axis.om.OutObject;
-import org.apache.axis.om.SOAPBody;
-import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.*;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -125,7 +119,7 @@
             }else if(String[].class.equals(parms[i])){
                 objs[i] = SimpleTypeEncodingUtils.deserializeStringArray(xpp);
             }else{
-                throw new UnsupportedOperationException("Only int and the String supported yet");
+                throw new UnsupportedOperationException("Only int,String and String[] is supported yet");
             } 
         }
         return objs;
@@ -163,9 +157,11 @@
             OMNamespace ns = fac.createOMNamespace("http://soapenc/","res");
             OMElement responseMethodName = fac.createOMElement(methodName+"Response",ns);
             responseEnvelope.getBody().addChild(responseMethodName);
-            OMElement returnelement = fac.createOMElement("return",ns);
+            OMElement returnelement = fac.createOMElement(methodName+"Return",ns);
             responseMethodName.addChild(returnelement);
+
             returnelement.setBuilder(new ObjectToOMBuilder(returnelement,outobj));
+            returnelement.declareNamespace(OMConstants.ARRAY_ITEM_NSURI,"arrays");
             msgContext.setEnvelope(responseEnvelope);
             
             return msgContext;

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java	Wed Jan 26 06:59:38 2005
@@ -69,6 +69,7 @@
     protected void doPost(HttpServletRequest req, HttpServletResponse res)
         throws ServletException, IOException {
         try {
+            res.setContentType("text/xml; charset=utf-8");
             AxisEngine engine  = new AxisEngine(engineRegistry);
             MessageContext msgContext = new MessageContext(engineRegistry);
             msgContext.setServerSide(true);

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMConstants.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMConstants.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMConstants.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMConstants.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMConstants.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/OMConstants.java	Wed Jan 26 06:59:38 2005
@@ -44,4 +44,6 @@
     public static final short PUSH_TYPE_BUILDER=0;
     public static final short PULL_TYPE_BUILDER=1;
 
+    public static final String ARRAY_ITEM_NSURI = "http://axis.apache.org/encoding/Arrays";
+    public static final String ARRAY_ITEM_LOCALNAME = "item";
 }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/DeploymentotalTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/DeploymentotalTest.java?view=diff&rev=126506&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/DeploymentotalTest.java&r1=126505&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/DeploymentotalTest.java&r2=126506
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/DeploymentotalTest.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/DeploymentotalTest.java	Wed Jan 26 06:59:38 2005
@@ -26,7 +26,7 @@
 public class DeploymentotalTest extends TestCase {
     EngineRegistry er = null;
     public void testparseService1() throws PhaseException ,DeploymentException, AxisFault, XMLStreamException{
-        String filename = "./target/test-resources/deployment" ;
+        String filename = "C:/deployment" ;
         DeploymentEngine deploymentEngine = new DeploymentEngine(filename);
         er = deploymentEngine.start();
 //       try {