axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava JavaStubWriter.java
Date Wed, 20 Mar 2002 21:52:23 GMT
dims        02/03/20 13:52:23

  Modified:    java/src/org/apache/axis/client Service.java
               java/src/org/apache/axis/wsdl/toJava JavaStubWriter.java
  Log:
  - Adding support in Stub to keep track of the last "call".
    - Using TLS to avoid threading problems.
    - Stub's getCall() can be used to get the last "call"
  - Renaming getCall() in generated code to createCall() as a new call is created everytime.
  
  Revision  Changes    Path
  1.44      +19 -8     xml-axis/java/src/org/apache/axis/client/Service.java
  
  Index: Service.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Service.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Service.java	20 Feb 2002 14:11:17 -0000	1.43
  +++ Service.java	20 Mar 2002 21:52:23 -0000	1.44
  @@ -55,7 +55,6 @@
   
   package org.apache.axis.client ;
   
  -import javax.wsdl.extensions.soap.SOAPAddress;
   import org.apache.axis.AxisEngine;
   import org.apache.axis.EngineConfiguration;
   import org.apache.axis.configuration.DefaultEngineConfigurationFactory;
  @@ -66,11 +65,11 @@
   import javax.naming.Reference;
   import javax.naming.Referenceable;
   import javax.naming.StringRefAddr;
  -
   import javax.wsdl.Binding;
   import javax.wsdl.Definition;
   import javax.wsdl.Port;
   import javax.wsdl.PortType;
  +import javax.wsdl.extensions.soap.SOAPAddress;
   import javax.wsdl.factory.WSDLFactory;
   import javax.wsdl.xml.WSDLReader;
   import javax.xml.rpc.ServiceException;
  @@ -80,6 +79,7 @@
   import java.io.FileNotFoundException;
   import java.io.InputStream;
   import java.io.Serializable;
  +import java.lang.reflect.Proxy;
   import java.net.MalformedURLException;
   import java.net.URL;
   import java.util.HashSet;
  @@ -87,7 +87,6 @@
   import java.util.List;
   import java.util.Map;
   import java.util.Set;
  -import java.lang.reflect.Proxy;
   
   /**
    * Axis' JAXRPC Dynamic Invoation Interface implementation of the Service
  @@ -111,6 +110,10 @@
       private javax.wsdl.Service  wsdlService     = null ;
       private boolean             maintainSession = false ;
   
  +    /**
  +     * Thread local storage used for storing the last call object
  +     */
  +    private static ThreadLocal previousCall = new ThreadLocal();
   
       Definition getWSDLDefinition() {
           return( wsdlDefinition );
  @@ -291,7 +294,8 @@
           }
   
           try {
  -            Call call = new Call(endpoint);
  +            Call call = (org.apache.axis.client.Call)createCall();
  +            call.setTargetEndpointAddress(new URL(endpoint));
               ClassLoader classLoader =
                       Thread.currentThread().getContextClassLoader();
               return (java.rmi.Remote)Proxy.newProxyInstance(classLoader,
  @@ -326,7 +330,7 @@
           if ( portType == null )
               throw new ServiceException( JavaUtils.getMessage("noPortType00", "" + portName)
);
   
  -        org.apache.axis.client.Call call = new org.apache.axis.client.Call(this);
  +        Call call = (org.apache.axis.client.Call)createCall();
           call.setPortTypeName( portName );
   
           // Get the URL
  @@ -364,7 +368,7 @@
                                            String operationName)
                              throws ServiceException {
   
  -        org.apache.axis.client.Call call=new org.apache.axis.client.Call(this);
  +        Call call = (org.apache.axis.client.Call)createCall();
           call.setOperation( portName, operationName );
           return( call );
       }
  @@ -383,7 +387,7 @@
                                            QName operationName)
                              throws ServiceException {
   
  -        org.apache.axis.client.Call call=new org.apache.axis.client.Call(this);
  +        Call call = (org.apache.axis.client.Call)createCall();
           call.setOperation( portName, operationName.getLocalPart() );
           return( call );
       }
  @@ -397,7 +401,9 @@
        * @throws ServiceException If there's an error
        */
       public javax.xml.rpc.Call createCall() throws ServiceException {
  -        return( new org.apache.axis.client.Call(this) );
  +        Call call = new org.apache.axis.client.Call(this);
  +        previousCall.set(call);
  +        return call;
       }
   
       /**
  @@ -565,5 +571,10 @@
        */
       public boolean getMaintainSession() {
           return maintainSession;
  +    }
  +
  +    public Call getCall() throws ServiceException {
  +        Call call = (Call) previousCall.get();
  +        return call;
       }
   }
  
  
  
  1.49      +2 -2      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
  
  Index: JavaStubWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- JavaStubWriter.java	20 Mar 2002 20:53:56 -0000	1.48
  +++ JavaStubWriter.java	20 Mar 2002 21:52:23 -0000	1.49
  @@ -167,7 +167,7 @@
   
           pw.println("    }");
           pw.println();
  -        pw.println("    private org.apache.axis.client.Call getCall() throws java.rmi.RemoteException
{");
  +        pw.println("    private org.apache.axis.client.Call createCall() throws java.rmi.RemoteException
{");
           pw.println("        try {");
           pw.println("            org.apache.axis.client.Call call =");
           pw.println("                    (org.apache.axis.client.Call) super.service.createCall();");
  @@ -493,7 +493,7 @@
           pw.println("        if (super.cachedEndpoint == null) {");
           pw.println("            throw new org.apache.axis.NoEndPointException();");
           pw.println("        }");
  -        pw.println("        org.apache.axis.client.Call call = getCall();");
  +        pw.println("        org.apache.axis.client.Call call = createCall();");
   
           // loop over paramters and set up in/out params
           for (int i = 0; i < parms.list.size(); ++i) {
  
  
  

Mime
View raw message