owenb       2002/12/11 10:17:36

  Modified:    java/src/org/apache/wsif/providers/soap/apachesoap
                        WSIFPort_ApacheSOAP.java
  Log:
  Fixed serialization by making non-Serializable global variables transient and 
implementing readObject and writeObject methods
  
  Revision  Changes    Path
  1.21      +49 -3     
xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFPort_ApacheSOAP.java
  
  Index: WSIFPort_ApacheSOAP.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFPort_ApacheSOAP.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WSIFPort_ApacheSOAP.java  7 Dec 2002 12:33:59 -0000       1.20
  +++ WSIFPort_ApacheSOAP.java  11 Dec 2002 18:17:36 -0000      1.21
  @@ -57,6 +57,9 @@
   
   package org.apache.wsif.providers.soap.apachesoap;
   
  +import java.io.IOException;
  +import java.io.ObjectInputStream;
  +import java.io.ObjectOutputStream;
   import java.net.MalformedURLException;
   import java.net.URL;
   import java.util.HashMap;
  @@ -111,11 +114,11 @@
   
        private static final long serialVersionUID = 1L;
   
  -    protected Map operationInstances = new HashMap();
  +    transient protected Map operationInstances = new HashMap();
       protected Port port;
       protected Definition definition;
  -    protected Call call;
  -    protected SOAPTransport st;
  +    transient protected Call call;
  +    transient protected SOAPTransport st;
       protected URL url;
       protected String style = "document";
       protected String partSerializerName = null;
  @@ -783,4 +786,47 @@
   
           return buff;
       }
  +
  +    private void writeObject(ObjectOutputStream oos) throws IOException {
  +        oos.defaultWriteObject();
  +    }
  +
  +    private void readObject(ObjectInputStream ois)
  +        throws ClassNotFoundException, IOException {
  +        ois.defaultReadObject();
  +                
  +        // reset the operation instances
  +        operationInstances = new HashMap();
  +        
  +        // The transient call reference does not need to be re-established here 
since it will
  +        // be taken care of when getCall is next invoked. However, the 
SOAPTransport needs to
  +        // be set again
  +        JMSAddress ja =
  +            (JMSAddress) getExtElem(port,
  +                JMSAddress.class,
  +                port.getExtensibilityElements());
  +        SOAPAddress sa =
  +            (SOAPAddress) getExtElem(port,
  +                SOAPAddress.class,
  +                port.getExtensibilityElements());
  +
  +        if (sa != null && ja != null)
  +            throw new WSIFException(
  +                "Both soap:address and jms:address cannot be specified for port "
  +                    + port.getName());
  +
  +        if (sa == null && ja == null)
  +            throw new WSIFException(
  +                "Either soap:address or jms:address must be specified for port "
  +                    + port.getName());
  +
  +        if (ja != null) {
  +            // Port jms:address binding element
  +            jmsAddressPropVals = ja.getJMSPropertyValues();
  +            st = new SOAPJMSConnection(ja, port.getName());
  +        } else {
  +            // Port soap:address bindng element
  +            st = new SOAPHTTPConnection();
  +        }        
  +    }   
   }
  
  
  


Reply via email to