dims        2002/06/14 09:43:52

  Modified:    java/src/org/apache/axis/client Call.java
  Log:
  Improve invokeOneWay for TCK compliance.
  
  Revision  Changes    Path
  1.137     +32 -6     xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.136
  retrieving revision 1.137
  diff -u -r1.136 -r1.137
  --- Call.java 14 Jun 2002 13:27:17 -0000      1.136
  +++ Call.java 14 Jun 2002 16:43:52 -0000      1.137
  @@ -166,6 +166,9 @@
   
       private OperationDesc      operation       = new OperationDesc();
   
  +    // Is this a one-way call?
  +    private boolean invokeOneWay               = false;
  +
       // Our Transport, if any
       private Transport          transport       = null ;
       private String             transportName   = null ;
  @@ -1200,10 +1203,12 @@
        */
       public void invokeOneWay(Object[] params) {
           try {
  +            invokeOneWay = true;
               invoke( params );
  -        }
  -        catch( Exception exp ) {
  +        } catch( Exception exp ) {
               throw new JAXRPCException( exp.toString() );
  +        } finally {
  +            invokeOneWay = false;
           }
       }
   
  @@ -1672,7 +1677,7 @@
            * parameter types, check for this case right now and toss a fault
            * if things don't look right.
            */
  -        if (operation.getNumParams() > 0 && returnType == null) {
  +        if (!invokeOneWay && operation.getNumParams() > 0 && returnType == null) {
               throw new AxisFault(JavaUtils.getMessage("mustSpecifyReturnType"));
           }
   
  @@ -1924,7 +1929,18 @@
                   log.debug(writer.getBuffer().toString());
               }
           }
  +        if(!invokeOneWay) {
  +            invokeEngine(msgContext);
  +        } else {
  +            invokeEngineOneWay(msgContext);
  +        }
   
  +        if (log.isDebugEnabled()) {
  +            log.debug("Exit: Call::invoke()");
  +        }
  +    }
  +
  +    private void invokeEngine(MessageContext msgContext) throws AxisFault {
           service.getEngine().invoke( msgContext );
   
           if (transport != null)
  @@ -1950,10 +1966,20 @@
           if (respBody instanceof SOAPFaultElement) {
               throw ((SOAPFaultElement)respBody).getFault();
           }
  +    }
   
  -        if (log.isDebugEnabled()) {
  -            log.debug("Exit: Call::invoke()");
  -        }
  +    private void invokeEngineOneWay(final MessageContext msgContext) throws 
AxisFault {
  +        Runnable runnable = new Runnable(){
  +            public void run() {
  +                try {
  +                    service.getEngine().invoke( msgContext );
  +                } catch (AxisFault af){
  +                    log.debug(JavaUtils.getMessage("exceptionPrinting"), af);
  +                }
  +            }
  +        };
  +        Thread thread = new Thread(runnable);
  +        thread.start();
       }
   
       /**
  
  
  


Reply via email to