20 * |
20 * |
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
22 * CA 95054 USA or visit www.sun.com if you need additional information or |
22 * CA 95054 USA or visit www.sun.com if you need additional information or |
23 * have any questions. |
23 * have any questions. |
24 */ |
24 */ |
25 /* |
|
26 * $Id: HttpSOAPConnection.java,v 1.41 2006/01/27 12:49:17 vj135062 Exp $ |
|
27 * $Revision: 1.41 $ |
|
28 * $Date: 2006/01/27 12:49:17 $ |
|
29 */ |
|
30 |
25 |
31 |
26 |
32 package com.sun.xml.internal.messaging.saaj.client.p2p; |
27 package com.sun.xml.internal.messaging.saaj.client.p2p; |
33 |
28 |
34 import java.io.*; |
29 import java.io.*; |
64 |
59 |
65 protected static final Logger log = |
60 protected static final Logger log = |
66 Logger.getLogger(LogDomainConstants.HTTP_CONN_DOMAIN, |
61 Logger.getLogger(LogDomainConstants.HTTP_CONN_DOMAIN, |
67 "com.sun.xml.internal.messaging.saaj.client.p2p.LocalStrings"); |
62 "com.sun.xml.internal.messaging.saaj.client.p2p.LocalStrings"); |
68 |
63 |
69 public static final String defaultProxyHost = null; |
64 private static final String defaultProxyHost = null; |
70 public static final int defaultProxyPort = -1; |
65 private static final int defaultProxyPort = -1; |
71 |
66 |
72 MessageFactory messageFactory = null; |
67 MessageFactory messageFactory = null; |
73 |
68 |
74 boolean closed = false; |
69 boolean closed = false; |
75 |
70 |
78 proxyPort = defaultProxyPort; |
73 proxyPort = defaultProxyPort; |
79 |
74 |
80 try { |
75 try { |
81 messageFactory = MessageFactory.newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL); |
76 messageFactory = MessageFactory.newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL); |
82 } catch (NoSuchMethodError ex) { |
77 } catch (NoSuchMethodError ex) { |
83 //fallback to default SOAP 1.1 in this case for backward compatibility |
78 //fallback to default SOAP 1.1 in this case for backward compatibility |
84 messageFactory = MessageFactory.newInstance(); |
79 messageFactory = MessageFactory.newInstance(); |
85 } catch (Exception ex) { |
80 } catch (Exception ex) { |
86 log.log(Level.SEVERE, "SAAJ0001.p2p.cannot.create.msg.factory", ex); |
81 log.log(Level.SEVERE, "SAAJ0001.p2p.cannot.create.msg.factory", ex); |
87 throw new SOAPExceptionImpl("Unable to create message factory", ex); |
82 throw new SOAPExceptionImpl("Unable to create message factory", ex); |
88 } |
83 } |
89 } |
84 } |
105 throw new SOAPExceptionImpl("Connection is closed"); |
100 throw new SOAPExceptionImpl("Connection is closed"); |
106 } |
101 } |
107 |
102 |
108 Class urlEndpointClass = null; |
103 Class urlEndpointClass = null; |
109 ClassLoader loader = Thread.currentThread().getContextClassLoader(); |
104 ClassLoader loader = Thread.currentThread().getContextClassLoader(); |
110 |
|
111 try { |
105 try { |
112 if (loader != null) { |
106 if (loader != null) { |
113 urlEndpointClass = loader.loadClass(JAXM_URLENDPOINT); |
107 urlEndpointClass = loader.loadClass(JAXM_URLENDPOINT); |
114 } else { |
108 } else { |
115 urlEndpointClass = Class.forName(JAXM_URLENDPOINT); |
109 urlEndpointClass = Class.forName(JAXM_URLENDPOINT); |
116 } |
110 } |
117 } catch (ClassNotFoundException ex) { |
111 } catch (ClassNotFoundException ex) { |
118 //Do nothing. URLEndpoint is available only when JAXM is there. |
112 //Do nothing. URLEndpoint is available only when JAXM is there. |
119 log.finest("SAAJ0090.p2p.endpoint.available.only.for.JAXM"); |
113 log.finest("SAAJ0090.p2p.endpoint.available.only.for.JAXM"); |
120 } |
114 } |
121 |
115 |
122 if (urlEndpointClass != null) { |
116 if (urlEndpointClass != null) { |
123 if (urlEndpointClass.isInstance(endPoint)) { |
117 if (urlEndpointClass.isInstance(endPoint)) { |
124 String url = null; |
118 String url = null; |
125 |
119 |
652 |
646 |
653 byte[] ret = bout.toByteArray(); |
647 byte[] ret = bout.toByteArray(); |
654 |
648 |
655 return ret; |
649 return ret; |
656 } |
650 } |
|
651 |
657 //private static String SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; |
652 //private static String SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; |
658 //private static String SSL_PROVIDER = |
653 //private static String SSL_PROVIDER = |
659 // "com.sun.net.ssl.internal.ssl.Provider"; |
654 // "com.sun.net.ssl.internal.ssl.Provider"; |
660 private static final String SSL_PKG; |
655 private static final String SSL_PKG; |
661 private static final String SSL_PROVIDER; |
656 private static final String SSL_PROVIDER; |
662 |
|
663 |
657 |
664 static { |
658 static { |
665 if (isIBMVM) { |
659 if (isIBMVM) { |
666 SSL_PKG ="com.ibm.net.ssl.internal.www.protocol"; |
660 SSL_PKG ="com.ibm.net.ssl.internal.www.protocol"; |
667 SSL_PROVIDER ="com.ibm.net.ssl.internal.ssl.Provider"; |
661 SSL_PROVIDER ="com.ibm.net.ssl.internal.ssl.Provider"; |
668 } else { |
662 } else { |
669 //if not IBM VM default to Sun. |
663 //if not IBM VM default to Sun. |
670 SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; |
664 SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; |
671 SSL_PROVIDER ="com.sun.net.ssl.internal.ssl.Provider"; |
665 SSL_PROVIDER ="com.sun.net.ssl.internal.ssl.Provider"; |
672 } |
666 } |
673 } |
667 } |
|
668 |
674 private void initHttps() { |
669 private void initHttps() { |
675 //if(!setHttps) { |
670 //if(!setHttps) { |
676 String pkgs = System.getProperty("java.protocol.handler.pkgs"); |
671 String pkgs = System.getProperty("java.protocol.handler.pkgs"); |
677 log.log(Level.FINE, |
672 log.log(Level.FINE, |
678 "SAAJ0053.p2p.providers", |
673 "SAAJ0053.p2p.providers", |