owenb 2002/12/11 10:13:00
Modified: java/src/org/apache/wsif/providers/soap/apachesoap Tag:
pre1_2_0-patches WSIFPort_ApacheSOAP.java
Log:
Fixed serialization by making non-Serializable global variables transient and
implementing readObject and writeObject methods
Revision Changes Path
No revision
No revision
1.19.2.1 +48 -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.19
retrieving revision 1.19.2.1
diff -u -r1.19 -r1.19.2.1
--- WSIFPort_ApacheSOAP.java 24 Oct 2002 16:09:08 -0000 1.19
+++ WSIFPort_ApacheSOAP.java 11 Dec 2002 18:13:00 -0000 1.19.2.1
@@ -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,46 @@
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();
+ }
+ }
}