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 du...@apache.org on 2001/06/02 18:02:21 UTC

cvs commit: xml-axis/java/src/org/apache/axis/utils/cache JavaMethod.java

dug         01/06/02 09:02:21

  Modified:    java/src/org/apache/axis/providers/java RPCProvider.java
               java/src/org/apache/axis/utils/cache JavaMethod.java
  Log:
  Add support in the RPC java provider for passing in the msgContext.
  It will search for the method with the params passed in the SOAPEnv
  and then if it doesn't find it, it will then add msgContext to the
  front and try again.
  Works for JWS files too.
  
  Revision  Changes    Path
  1.2       +30 -15    xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
  
  Index: RPCProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RPCProvider.java	2001/05/31 09:25:08	1.1
  +++ RPCProvider.java	2001/06/02 16:02:20	1.2
  @@ -109,9 +109,22 @@
                */
               
               
  -            String       mName = body.getMethodName();
  -            Vector       args  = body.getParams();
  +            String       mName      = body.getMethodName();
  +            Vector       args       = body.getParams();
  +            Object[]     argValues  =  null ;
               
  +            
  +            if ( args != null && args.size() > 0 ) {
  +                argValues = new Object[ args.size()];
  +                for ( int i = 0 ; i < args.size() ; i++ ) {
  +                    argValues[i]  = ((RPCParam)args.get(i)).getValue() ;
  +                    
  +                    if (DEBUG_LOG) {
  +                        System.out.println("  value: " + argValues[i] );
  +                    }
  +                }
  +            }
  +            
               if ( methodName != null && !methodName.equals(mName) )
                   throw new AxisFault( "AxisServer.error",
                                       "Method names don't match\n" +
  @@ -122,25 +135,27 @@
               Debug.Print( 2, "mName: " + mName );
               Debug.Print( 2, "MethodName: " + methodName );
               Method       method = jc.getMethod(mName, args.size());
  +
  +            if ( method == null ) {
  +              // If method wasn't found using the args that were passed 
  +              // in then try again, this time with MessageContext frist
  +              args.add( 0, msgContext );
  +              method = jc.getMethod(mName, args.size());
  +              if ( method != null ) {
  +                Object[] tmpArgs = new Object[args.size()];
  +                for ( int i = 1 ; i < args.size() ; i++ )
  +                  tmpArgs[i] = argValues[i-1];
  +                tmpArgs[0] = msgContext ;
  +                argValues = tmpArgs ;
  +              }
  +            }
  +
               if ( method == null )
                   throw new AxisFault( "AxisServer.error",
                                       "Method not found\n" +
                                           "Method name=" + methodName + "\n" +
                                           "Service name=" + msgContext.getTargetService(),
                                       null, null );
  -            
  -            Object[] argValues  =  null ;
  -            
  -            if ( args != null && args.size() > 0 ) {
  -                argValues = new Object[ args.size()];
  -                for ( int i = 0 ; i < args.size() ; i++ ) {
  -                    argValues[i]  = ((RPCParam)args.get(i)).getValue() ;
  -                    
  -                    if (DEBUG_LOG) {
  -                        System.out.println("  value: " + argValues[i] );
  -                    }
  -                }
  -            }
               
               Object objRes = method.invoke( obj, argValues );
               
  
  
  
  1.3       +2 -1      xml-axis/java/src/org/apache/axis/utils/cache/JavaMethod.java
  
  Index: JavaMethod.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/cache/JavaMethod.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaMethod.java	2001/05/22 18:42:41	1.2
  +++ JavaMethod.java	2001/06/02 16:02:21	1.3
  @@ -120,7 +120,8 @@
                   }
               }
           } 
  -
  +        if ( unique.getParameterTypes().length != numargs )
  +          return null ;
           return unique;
       }
   };