axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r111270 - in webservices/axis/trunk/java/dev/scratch/prototype2: . src/java/org/apache/axis/client src/java/org/apache/axis/engine src/java/org/apache/axis/impl/llom src/java/org/apache/axis/impl/transport/http src/java/org/apache/axis/om src/test/org/apache/axis/engine
Date Wed, 08 Dec 2004 13:58:02 GMT
Author: hemapani
Date: Wed Dec  8 05:57:58 2004
New Revision: 111270

URL: http://svn.apache.org/viewcvs?view=rev&rev=111270
Log:
add a test case to handler the service when failed
Added:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java
Modified:
   webservices/axis/trunk/java/dev/scratch/prototype2/project.xml
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/client/Call.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/ServiceLocator.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/HTTPTrasnportSender.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/ServerHttpHandler.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleAxisServer.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineTest.java

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/project.xml
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/project.xml?view=diff&rev=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/project.xml&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/project.xml&r2=111270
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/project.xml	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/project.xml	Wed Dec  8 05:57:58 2004
@@ -82,6 +82,7 @@
         <exclude>**/*Abstract*.java</exclude>
 	    <exclude>**/*Util*.java</exclude>
         <exclude>**/*BadInputTest.java</exclude>
+        <exclude>**/*CallUnregisterdServiceTest.java</exclude>
       </excludes>
       <includes>
         <include>**/*Test.java</include>

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/client/Call.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/client/Call.java?view=diff&rev=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/client/Call.java&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/client/Call.java&r2=111270
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/client/Call.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/client/Call.java
Wed Dec  8 05:57:58 2004
@@ -42,6 +42,7 @@
 import org.apache.axis.om.OMNode;
 import org.apache.axis.om.SOAPBody;
 import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPFault;
 import org.apache.axis.registry.EngineRegistry;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -92,6 +93,9 @@
             while(children != null && children.hasNext() ){
                 OMNode child = (OMNode)children.next();
                 if(child.getType() == OMNode.ELEMENT_NODE){
+                    if(child instanceof SOAPFault){
+                        throw AxisFault.makeFault(((SOAPFault)child).getException());
+                    }
                     return (OMElement)child;
                 }
             }

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=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java&r2=111270
==============================================================================
--- 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 Dec  8 05:57:58 2004
@@ -16,6 +16,8 @@
 
 package org.apache.axis.engine;
 
+import javax.xml.namespace.QName;
+
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.impl.handlers.OpNameFinder;
 import org.apache.axis.registry.EngineRegistry;
@@ -23,8 +25,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.namespace.QName;
-
 /**
  *  There is one engine for the Server and the Client. the send() and recive() 
  *  Methods are the basic operations the Sync, Async messageing are build on top.
@@ -51,25 +51,19 @@
                 ExecutionChain exeChain = service.getOutputExecutionChain();
                 exeChain.invoke(mc);
             }
-            TransportSender ts = TransportSenderLocator.locateTransPortSender(mc);
-            ts.invoke(mc);
+            sendTheMessage(mc);
         }catch(AxisFault e){
-            if(mc.isProcessingFault()){
-                //TODO log and exit
-                log.debug("Error in fault flow",e);
-            }else{
-                log.debug("send failed",e);
-                mc.setProcessingFault(true);
-                ExecutionChain faultExeChain = service.getFaultExecutionChain();
-                faultExeChain.invoke(mc);
-            }
+            handleFault(mc,e,service);
         }
         log.info("end the send()");
     }
     
     public void recive(MessageContext mc)throws AxisFault{
-        QName currentServiceName = null;
-        Service service = mc.getService();
+        Service service = null;
+        if(mc.isServerSide()){
+            service = ServiceLocator.locateService(mc);
+            mc.setService(service);
+        }
 
         try{
             if(service != null){
@@ -83,19 +77,30 @@
                 reciver.invoke(mc);
             }
         }catch(AxisFault e){
-            if(mc.isProcessingFault()){
-                //TODO log and exit
-                log.debug("Error in fault flow",e);
-            }else{
-                log.debug("recive failed",e);
-                mc.setProcessingFault(true);
-                ExecutionChain faultExeChain = service.getFaultExecutionChain();
-                faultExeChain.invoke(mc);
-            }
-            e.printStackTrace();
+            handleFault(mc,e,service);
         }
         log.info("end the recive()");
     }    
+    
+    private void sendTheMessage(MessageContext msgCtx)throws AxisFault{
+        TransportSender ts = TransportSenderLocator.locateTransPortSender(msgCtx);
+        ts.invoke(msgCtx);
+    }
+    
+    private void handleFault(MessageContext mc,Exception e,Service service) throws AxisFault{
+        if(mc.isProcessingFault()){
+            //TODO log and exit
+            log.error("Error in fault flow",e);
+        }else{
+            log.debug("recive failed",e);
+            mc.setProcessingFault(true);
+            ExecutionChain faultExeChain = service.getFaultExecutionChain();
+            faultExeChain.invoke(mc);
+            mc.getEnvelope().getBody().addFault(e);
+            sendTheMessage(mc);
+        }
+    }
+    
 	/**
 	 * @return Returns the registry.
 	 */

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/ServiceLocator.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/ServiceLocator.java?view=diff&rev=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/ServiceLocator.java&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/ServiceLocator.java&r2=111270
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/ServiceLocator.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/ServiceLocator.java
Wed Dec  8 05:57:58 2004
@@ -25,7 +25,21 @@
  * @author Srinath Perera(hemapani@opensource.lk)
  */
 public class ServiceLocator {
-    public static Service locateService(String uri,String soapAction,MessageContext msgctx)
throws AxisFault{
+    public static Service locateService(MessageContext msgctx) throws AxisFault{
+        String uri = null;
+        String filePart = (String)msgctx.getProperty(MessageContext.REQUEST_URL);
+        String soapAction = (String)msgctx.getProperty(MessageContext.SOAP_ACTION);
+        
+        if (filePart.startsWith("axis/services/")) {
+            String servicePart = filePart.substring(14);
+            int separator = servicePart.indexOf('/');
+            if (separator > -1) {
+                uri = servicePart.substring(0, separator);
+            }else{
+                uri = servicePart;
+            }
+        }
+
         QName serviceName = null;
         if(uri != null){
             int index = uri.indexOf('?');

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java?view=diff&rev=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java&r2=111270
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
Wed Dec  8 05:57:58 2004
@@ -1,5 +1,6 @@
 package org.apache.axis.impl.llom;
 
+import org.apache.axis.engine.AxisFault;
 import org.apache.axis.om.*;
 
 import javax.xml.namespace.QName;
@@ -71,5 +72,12 @@
 
     public void setFaultString(String faultString, Locale locale) throws OMException {
         throw new UnsupportedOperationException(); //TODO implement this
+    }
+    public Exception getException() throws OMException {
+        if(e == null){
+            return new AxisFault();        
+        }else{
+            return e;
+        }
     }
 }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/HTTPTrasnportSender.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/HTTPTrasnportSender.java?view=diff&rev=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/HTTPTrasnportSender.java&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/HTTPTrasnportSender.java&r2=111270
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/HTTPTrasnportSender.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/HTTPTrasnportSender.java
Wed Dec  8 05:57:58 2004
@@ -36,8 +36,24 @@
     }
     
     public void invoke(MessageContext msgContext) throws AxisFault {
-//        try {
-            OutputStream out = (OutputStream)msgContext.getProperty(MessageContext.TRANSPORT_DATA);
+        OutputStream out = null;
+        if(msgContext.isProcessingFault()){
+            //Means we are processing fault
+            if(msgContext.getFaultTo()!= null){
+                throw new UnsupportedOperationException("Addressing not suppotrted yet");
+            }else{
+                out = (OutputStream)msgContext.getProperty(MessageContext.TRANSPORT_DATA);
+            }
+        }else{
+            if(msgContext.getTo()!= null){
+                throw new UnsupportedOperationException("Addressing not suppotrted yet");
+            }else if(msgContext.getReplyTo() != null){
+                throw new UnsupportedOperationException("Addressing not suppotrted yet");
+            }else{
+                out = (OutputStream)msgContext.getProperty(MessageContext.TRANSPORT_DATA);
+            }
+        }
+        
 //            if(!msgContext.isServerSide()){
 //                URL url = (URL)msgContext.getProperty(MessageContext.REQUEST_URL);
 //                if(url != null){
@@ -50,17 +66,13 @@
 //                    throw new AxisFault(MessageContext.REQUEST_URL + "where to send ?");
 //                }
 //            }
+        
+        SOAPEnvelope envelope = msgContext.getEnvelope();
+        if(envelope != null){
+            SimpleOMSerializer serializer = new SimpleOMSerializer();
+            serializer.serialize(envelope,this.out);
             
-            SOAPEnvelope envelope = msgContext.getEnvelope();
-            if(envelope != null){
-                SimpleOMSerializer serializer = new SimpleOMSerializer();
-                serializer.serialize(envelope,this.out);
-                
-            }
-//        } catch (IOException e) {
-//            // TODO Auto-generated catch block
-//            e.printStackTrace();
-//        }
+        }
     }
 
     public void revoke(MessageContext msgContext) {

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/ServerHttpHandler.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/ServerHttpHandler.java?view=diff&rev=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/ServerHttpHandler.java&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/ServerHttpHandler.java&r2=111270
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/ServerHttpHandler.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/ServerHttpHandler.java
Wed Dec  8 05:57:58 2004
@@ -43,7 +43,7 @@
     private AxisEngine engine;
     private SimpleAxisServer server;
     private Socket socket;
-    private String serviceFromURI;
+//    private String serviceFromURI;
     
     public ServerHttpHandler(SimpleAxisServer server, Socket socket,AxisEngine engine) {
         this.server = server;
@@ -116,16 +116,17 @@
 
 
             String filePart = fileName.toString();
-            if (filePart.startsWith("axis/services/")) {
-                String servicePart = filePart.substring(14);
-                int separator = servicePart.indexOf('/');
-                if (separator > -1) {
-                    msgContext.setProperty("objectID",
-                                   servicePart.substring(separator + 1));
-                    servicePart = servicePart.substring(0, separator);
-                }
-               this.serviceFromURI = servicePart;
-            }
+            msgContext.setProperty(MessageContext.REQUEST_URL,filePart);
+//            if (filePart.startsWith("axis/services/")) {
+//                String servicePart = filePart.substring(14);
+//                int separator = servicePart.indexOf('/');
+//                if (separator > -1) {
+//                    msgContext.setProperty("objectID",
+//                                   servicePart.substring(separator + 1));
+//                    servicePart = servicePart.substring(0, separator);
+//                }
+//               this.serviceFromURI = servicePart;
+//            }
 
             if (authInfo.length() > 0) {
                 // Process authentication info
@@ -157,8 +158,6 @@
                     msgContext.setProperty(MessageContext.SOAP_ACTION,soapActionString);
                 }
                 
-                Service service = ServiceLocator.locateService(serviceFromURI,soapActionString,msgContext);
-                msgContext.setService(service);
                 // Send it on its way...
                 OutputStream out = socket.getOutputStream();
                 out.write(HTTP);

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleAxisServer.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleAxisServer.java?view=diff&rev=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleAxisServer.java&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleAxisServer.java&r2=111270
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleAxisServer.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleAxisServer.java
Wed Dec  8 05:57:58 2004
@@ -74,27 +74,31 @@
      * Axis engine for processing.
      */
     public void run() {
-        try {
-            // Accept and process requests from the socket
-            while (!stopped) {
-                try {
-                    this.socket = serverSocket.accept();
-                   
-                } catch (java.io.InterruptedIOException iie) {
-                } catch (Exception e) {
-                    log.debug(e.getMessage(), e);
-                    break;
-                }
-                if (socket != null) {
-                    ServerHttpHandler worker = new ServerHttpHandler(this, socket,engine);
-                    MessageContext msgContext = worker.parseHTTPHeaders();
-                    engine.recive(msgContext);
-                    this.socket.close();
-                    this.socket = null;
+        try{
+            try {
+                // Accept and process requests from the socket
+                while (!stopped) {
+                    try {
+                        this.socket = serverSocket.accept();
+                       
+                    } catch (java.io.InterruptedIOException iie) {
+                    } catch (Exception e) {
+                        log.debug(e.getMessage(), e);
+                        break;
+                    }
+                    if (socket != null) {
+                        ServerHttpHandler worker = new ServerHttpHandler(this, socket,engine);
+                        MessageContext msgContext = worker.parseHTTPHeaders();
+                        engine.recive(msgContext);
+                        this.socket.close();
+                        this.socket = null;
+                    }
                 }
-            }
-        } catch (AxisFault e) {
-            log.error(e);
+            } catch (AxisFault e) {
+                log.error(e);
+                this.socket.close();
+                this.socket = null;
+            }     
         }catch (IOException e) {
             log.error(e);
         }
@@ -148,15 +152,15 @@
         try {
             if(serverSocket != null) {
                 serverSocket.close();
-                while(socket != null){
-                    try {
-                        //make sure all sockets closed by the time 
-                        //else we got in to lot of trouble testing
-                        Thread.sleep(1000);
-                    } catch (InterruptedException e1) {
-                        log.error(e1);
-                    }
-                }
+//                while(socket != null){
+//                    try {
+//                        //make sure all sockets closed by the time 
+//                        //else we got in to lot of trouble testing
+//                        Thread.sleep(1000);
+//                    } catch (InterruptedException e1) {
+//                        log.error(e1);
+//                    }
+//                }
             }
         } catch (IOException e) {
             log.info(e);

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java?view=diff&rev=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java&r2=111270
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java
Wed Dec  8 05:57:58 2004
@@ -16,6 +16,9 @@
 package org.apache.axis.om;
 
 import javax.xml.namespace.QName;
+
+import org.apache.axis.engine.AxisFault;
+
 import java.util.Locale;
 
 
@@ -131,7 +134,5 @@
     public abstract void setFaultString(String faultString, Locale locale) throws OMException;
 
 
-
-
-
+    public abstract Exception getException() throws OMException;
 }

Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java?view=auto&rev=111270
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java
Wed Dec  8 05:57:58 2004
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.engine;
+
+//todo
+import java.net.ServerSocket;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.AbstractTestCase;
+import org.apache.axis.client.Call;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.impl.engine.OperationImpl;
+import org.apache.axis.impl.engine.ServiceImpl;
+import org.apache.axis.impl.providers.RawXMLProvider;
+import org.apache.axis.impl.registry.ParameterImpl;
+import org.apache.axis.impl.transport.http.SimpleAxisServer;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.registry.EngineRegistry;
+import org.apache.axis.registry.Operation;
+import org.apache.axis.registry.Parameter;
+import org.apache.axis.registry.Service;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class CallUnregisterdServiceTest extends AbstractTestCase{
+    private Log log = LogFactory.getLog(getClass());
+    private QName serviceName = new QName("","EchoXMLService");
+    private QName operationName = new QName("http://localhost/my","echoOMElement");
+    private QName transportName = new QName("http://localhost/my","NullTransport");
+
+    private EngineRegistry engineRegistry;
+    private MessageContext mc;
+    private Thread thisThread = null;
+    private SimpleAxisServer sas;
+    private int testingPort = 7777;
+    private int testCount = 0;
+    
+    public CallUnregisterdServiceTest(){
+        super(CallUnregisterdServiceTest.class.getName());
+    }
+
+    public CallUnregisterdServiceTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        engineRegistry = Utils.createMockRegistry(serviceName,operationName,transportName);
+        Service service = new ServiceImpl(serviceName);
+        service.setClassLoader(Thread.currentThread().getContextClassLoader());
+        Parameter classParam = new ParameterImpl("className",EchoXML.class.getName());
+        service.addParameter(classParam);
+        service.setProvider(new RawXMLProvider());
+        Operation operation = new OperationImpl(operationName,service);
+        
+        service.addOperation(operation);
+        
+        ExecutionChain inchain = new ExecutionChain();
+        inchain.addPhase(new Phase(Constants.PHASE_SERVICE));
+        EngineUtils.addHandlers(service.getInFlow(),inchain,Constants.PHASE_SERVICE);
+        service.setInputExecutionChain(inchain);
+        
+        ExecutionChain outchain = new ExecutionChain();
+        outchain.addPhase(new Phase(Constants.PHASE_SERVICE));
+        EngineUtils.addHandlers(service.getOutFlow(),outchain,Constants.PHASE_SERVICE);
+        service.setOutExecutionChain(outchain);
+        
+        ExecutionChain faultchain = new ExecutionChain();
+        
+        faultchain.addPhase(new Phase(Constants.PHASE_SERVICE));
+        
+        EngineUtils.addHandlers(service.getFaultFlow(),faultchain,Constants.PHASE_SERVICE);
+        service.setFaultExecutionChain(outchain);
+        
+        engineRegistry.addService(service);
+        
+        AxisEngine engine = new AxisEngine(engineRegistry);
+        ServerSocket serverSoc = new ServerSocket(testingPort);
+        sas = new SimpleAxisServer(engine);
+        sas.setServerSocket(serverSoc);
+        thisThread = new Thread(sas);
+        thisThread.setDaemon(true);
+        thisThread.start();
+    }
+
+    protected void tearDown() throws Exception {
+            sas.stop();   
+            Thread.sleep(1000);
+    }
+
+
+    public void testEchoXMLSync() throws Exception{
+        try{
+            OMFactory fac = OMFactory.newInstance();
+
+            OMNamespace omNs = fac.createOMNamespace("http://localhost/my","my");
+            OMElement method =  fac.createOMElement("echoOMElement",omNs) ;
+            OMElement value =  fac.createOMElement("myValue",omNs) ;
+            value.setValue("Isaac Assimov, the foundation Sega");
+            method.addChild(value);
+            
+            Call call = new Call();
+            URL url = new URL("http","127.0.0.1",testingPort,"/axis/services/EchoBadXMLService");
+            OMElement omele = call.syncCall(method,url);
+            assertNotNull(omele);
+        }catch(AxisFault e){
+            //e.printStackTrace();
+            tearDown();
+            return;
+        }
+        fail("the test must fail due ti bad service Name");    
+    }
+}

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineTest.java?view=diff&rev=111270&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineTest.java&r1=111269&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineTest.java&r2=111270
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineTest.java
Wed Dec  8 05:57:58 2004
@@ -47,7 +47,7 @@
         engineRegistry = Utils.createMockRegistry(serviceName,operationName,transportName);
         mc = new MessageContext(engineRegistry);
         Service service = engineRegistry.getService(serviceName);
-        mc.setService(service);
+        mc.setProperty(MessageContext.REQUEST_URL,"/axis/services/EchoService");
         mc.setOperation(service.getOperation(operationName));
         
         OutputStream out = System.out;

Mime
View raw message