1.1 --- a/src/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java Mon Apr 20 15:25:02 2009 -0700 1.2 +++ b/src/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java Mon May 04 21:10:41 2009 -0700 1.3 @@ -55,12 +55,19 @@ 1.4 */ 1.5 public class HttpSOAPConnection extends SOAPConnection { 1.6 1.7 - protected static Logger log = 1.8 + public static final String vmVendor = System.getProperty("java.vendor.url"); 1.9 + private static final String sunVmVendor = "http://java.sun.com/"; 1.10 + private static final String ibmVmVendor = "http://www.ibm.com/"; 1.11 + private static final boolean isSunVM = sunVmVendor.equals(vmVendor) ? true: false; 1.12 + private static final boolean isIBMVM = ibmVmVendor.equals(vmVendor) ? true : false; 1.13 + private static final String JAXM_URLENDPOINT="javax.xml.messaging.URLEndpoint"; 1.14 + 1.15 + protected static final Logger log = 1.16 Logger.getLogger(LogDomainConstants.HTTP_CONN_DOMAIN, 1.17 "com.sun.xml.internal.messaging.saaj.client.p2p.LocalStrings"); 1.18 1.19 - public static String defaultProxyHost = null; 1.20 - public static int defaultProxyPort = -1; 1.21 + public static final String defaultProxyHost = null; 1.22 + public static final int defaultProxyPort = -1; 1.23 1.24 MessageFactory messageFactory = null; 1.25 1.26 @@ -72,6 +79,9 @@ 1.27 1.28 try { 1.29 messageFactory = MessageFactory.newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL); 1.30 + } catch (NoSuchMethodError ex) { 1.31 + //fallback to default SOAP 1.1 in this case for backward compatibility 1.32 + messageFactory = MessageFactory.newInstance(); 1.33 } catch (Exception ex) { 1.34 log.log(Level.SEVERE, "SAAJ0001.p2p.cannot.create.msg.factory", ex); 1.35 throw new SOAPExceptionImpl("Unable to create message factory", ex); 1.36 @@ -96,13 +106,18 @@ 1.37 } 1.38 1.39 Class urlEndpointClass = null; 1.40 + ClassLoader loader = Thread.currentThread().getContextClassLoader(); 1.41 1.42 try { 1.43 - urlEndpointClass = Class.forName("javax.xml.messaging.URLEndpoint"); 1.44 - } catch (Exception ex) { 1.45 - //Do nothing. URLEndpoint is available only when JAXM is there. 1.46 - log.finest("SAAJ0090.p2p.endpoint.available.only.for.JAXM"); 1.47 - } 1.48 + if (loader != null) { 1.49 + urlEndpointClass = loader.loadClass(JAXM_URLENDPOINT); 1.50 + } else { 1.51 + urlEndpointClass = Class.forName(JAXM_URLENDPOINT); 1.52 + } 1.53 + } catch (ClassNotFoundException ex) { 1.54 + //Do nothing. URLEndpoint is available only when JAXM is there. 1.55 + log.finest("SAAJ0090.p2p.endpoint.available.only.for.JAXM"); 1.56 + } 1.57 1.58 if (urlEndpointClass != null) { 1.59 if (urlEndpointClass.isInstance(endPoint)) { 1.60 @@ -639,10 +654,23 @@ 1.61 1.62 return ret; 1.63 } 1.64 + //private static String SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; 1.65 + //private static String SSL_PROVIDER = 1.66 + // "com.sun.net.ssl.internal.ssl.Provider"; 1.67 + private static final String SSL_PKG; 1.68 + private static final String SSL_PROVIDER; 1.69 1.70 - private static String SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; 1.71 - private static String SSL_PROVIDER = 1.72 - "com.sun.net.ssl.internal.ssl.Provider"; 1.73 + 1.74 + static { 1.75 + if (isIBMVM) { 1.76 + SSL_PKG ="com.ibm.net.ssl.internal.www.protocol"; 1.77 + SSL_PROVIDER ="com.ibm.net.ssl.internal.ssl.Provider"; 1.78 + } else { 1.79 + //if not IBM VM default to Sun. 1.80 + SSL_PKG = "com.sun.net.ssl.internal.www.protocol"; 1.81 + SSL_PROVIDER ="com.sun.net.ssl.internal.ssl.Provider"; 1.82 + } 1.83 + } 1.84 private void initHttps() { 1.85 //if(!setHttps) { 1.86 String pkgs = System.getProperty("java.protocol.handler.pkgs");