public SOAPMessage get(Object endPoint) throws SOAPException { if (closed) { log.severe("SAAJ0011.p2p.get.already.closed.conn"); throw new SOAPExceptionImpl("Connection is closed"); } Class urlEndpointClass = null; try { urlEndpointClass = Class.forName("javax.xml.messaging.URLEndpoint"); } catch (Exception ex) { // Do nothing. URLEndpoint is available only when JAXM is there. } if (urlEndpointClass != null) { if (urlEndpointClass.isInstance(endPoint)) { String url = null; try { Method m = urlEndpointClass.getMethod("getURL", (Class[]) null); url = (String) m.invoke(endPoint, (Object[]) null); } catch (Exception ex) { log.severe("SAAJ0004.p2p.internal.err"); throw new SOAPExceptionImpl("Internal error: " + ex.getMessage()); } try { endPoint = new URL(url); } catch (MalformedURLException mex) { log.severe("SAAJ0005.p2p."); throw new SOAPExceptionImpl("Bad URL: " + mex.getMessage()); } } } if (endPoint instanceof java.lang.String) { try { endPoint = new URL((String) endPoint); } catch (MalformedURLException mex) { log.severe("SAAJ0006.p2p.bad.URL"); throw new SOAPExceptionImpl("Bad URL: " + mex.getMessage()); } } if (endPoint instanceof URL) try { SOAPMessage response = doGet((URL) endPoint); return response; } catch (Exception ex) { throw new SOAPExceptionImpl(ex); } else throw new SOAPExceptionImpl("Bad endPoint type " + endPoint); }
private void initHttps() { // if(!setHttps) { String pkgs = SAAJUtil.getSystemProperty("java.protocol.handler.pkgs"); log.log(Level.FINE, "SAAJ0053.p2p.providers", new String[] {pkgs}); if (pkgs == null || pkgs.indexOf(SSL_PKG) < 0) { if (pkgs == null) pkgs = SSL_PKG; else pkgs = pkgs + "|" + SSL_PKG; System.setProperty("java.protocol.handler.pkgs", pkgs); log.log(Level.FINE, "SAAJ0054.p2p.set.providers", new String[] {pkgs}); try { Class c = Class.forName(SSL_PROVIDER); Provider p = (Provider) c.newInstance(); Security.addProvider(p); log.log(Level.FINE, "SAAJ0055.p2p.added.ssl.provider", new String[] {SSL_PROVIDER}); // System.out.println("Added SSL_PROVIDER " + SSL_PROVIDER); // setHttps = true; } catch (Exception ex) { } } // } }
public SOAPMessage call(SOAPMessage message, Object endPoint) throws SOAPException { if (closed) { log.severe("SAAJ0003.p2p.call.already.closed.conn"); throw new SOAPExceptionImpl("Connection is closed"); } Class urlEndpointClass = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { if (loader != null) { urlEndpointClass = loader.loadClass(JAXM_URLENDPOINT); } else { urlEndpointClass = Class.forName(JAXM_URLENDPOINT); } } catch (ClassNotFoundException ex) { // Do nothing. URLEndpoint is available only when JAXM is there. log.finest("SAAJ0090.p2p.endpoint.available.only.for.JAXM"); } if (urlEndpointClass != null) { if (urlEndpointClass.isInstance(endPoint)) { String url = null; try { Method m = urlEndpointClass.getMethod("getURL", (Class[]) null); url = (String) m.invoke(endPoint, (Object[]) null); } catch (Exception ex) { // TBD -- exception chaining log.log(Level.SEVERE, "SAAJ0004.p2p.internal.err", ex); throw new SOAPExceptionImpl("Internal error: " + ex.getMessage()); } try { endPoint = new URL(url); } catch (MalformedURLException mex) { log.log(Level.SEVERE, "SAAJ0005.p2p.", mex); throw new SOAPExceptionImpl("Bad URL: " + mex.getMessage()); } } } if (endPoint instanceof java.lang.String) { try { endPoint = new URL((String) endPoint); } catch (MalformedURLException mex) { log.log(Level.SEVERE, "SAAJ0006.p2p.bad.URL", mex); throw new SOAPExceptionImpl("Bad URL: " + mex.getMessage()); } } if (endPoint instanceof URL) try { SOAPMessage response = post(message, (URL) endPoint); return response; } catch (Exception ex) { // TBD -- chaining? throw new SOAPExceptionImpl(ex); } else { log.severe("SAAJ0007.p2p.bad.endPoint.type"); throw new SOAPExceptionImpl("Bad endPoint type " + endPoint); } }