private String getURL() { String url = ""; try { url = ConnectionManagerCache.getLocalEndpointURLByServiceName( NhincConstants.HIEM_SUBSCRIBE_ENTITY_SERVICE_NAME_SECURED); } catch (Exception ex) { log.error(ex.getMessage(), ex); } return url; }
private String getUrl(NhinTargetSystemType target, String serviceName) { String url = null; try { url = ConnectionManagerCache.getEndpontURLFromNhinTarget(target, serviceName); } catch (ConnectionManagerException ex) { log.warn( "exception occurred accessing url from connection manager (getEndpontURLFromNhinTarget)", ex); } if (NullChecker.isNullish(url)) { try { url = ConnectionManagerCache.getLocalEndpointURLByServiceName(serviceName); } catch (ConnectionManagerException ex) { log.warn( "exception occurred accessing url from connection manager (getLocalEndpointURLByServiceName)", ex); } } return url; }
private AdapterNotificationConsumerPortType getPort() { AdapterNotificationConsumerPortType port = adapterNotifyService.getAdapterNotificationConsumerPortSoap(); String url = null; try { url = ConnectionManagerCache.getLocalEndpointURLByServiceName( NhincConstants.HIEM_NOTIFY_ADAPTER_SERVICE_NAME); } catch (ConnectionManagerException ex) { log.error( "Error: Failed to retrieve url for service: " + NhincConstants.HIEM_NOTIFY_ADAPTER_SERVICE_NAME + " for local home community"); log.error(ex.getMessage()); } log.info("Setting endpoint address to Adapter Hiem Notify Service to " + url); ((javax.xml.ws.BindingProvider) port) .getRequestContext() .put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); return port; }
protected String invokeConnectionManager(String serviceName) throws ConnectionManagerException { return ConnectionManagerCache.getLocalEndpointURLByServiceName(serviceName); }
public FindAuditEventsResponseType auditQuery(FindAuditEventsRequestType request) { String url = null; try { log.debug( "NhincConstants.AUDIT_LOG_ADAPTER_SERVICE_NAME: " + NhincConstants.AUDIT_LOG_ADAPTER_SERVICE_NAME); url = ConnectionManagerCache.getLocalEndpointURLByServiceName( NhincConstants.AUDIT_LOG_ADAPTER_SERVICE_NAME); } catch (ConnectionManagerException ex) { log.error( "Error: Failed to retrieve url for service: " + NhincConstants.AUDIT_LOG_ADAPTER_SERVICE_NAME + " for local home community"); log.error(ex.getMessage()); } AdapterAuditLogQueryPortType port = getAdapterPort(url); FindAuditEventsResponseType resp = null; int retryCount = gov.hhs.fha.nhinc.webserviceproxy.WebServiceProxyHelper.getInstance().getRetryAttempts(); int retryDelay = gov.hhs.fha.nhinc.webserviceproxy.WebServiceProxyHelper.getInstance().getRetryDelay(); String exceptionText = gov.hhs.fha.nhinc.webserviceproxy.WebServiceProxyHelper.getInstance().getExceptionText(); javax.xml.ws.WebServiceException catchExp = null; if (retryCount > 0 && retryDelay > 0 && exceptionText != null && !exceptionText.equalsIgnoreCase("")) { int i = 1; while (i <= retryCount) { try { resp = port.findAuditEvents(request); break; } catch (javax.xml.ws.WebServiceException e) { catchExp = e; int flag = 0; StringTokenizer st = new StringTokenizer(exceptionText, ","); while (st.hasMoreTokens()) { if (e.getMessage().contains(st.nextToken())) { flag = 1; } } if (flag == 1) { log.warn("Exception calling ... web service: " + e.getMessage()); System.out.println( "retrying the connection for attempt [ " + i + " ] after [ " + retryDelay + " ] seconds"); log.info( "retrying attempt [ " + i + " ] the connection after [ " + retryDelay + " ] seconds"); i++; try { Thread.sleep(retryDelay); } catch (InterruptedException iEx) { log.error( "Thread Got Interrupted while waiting on AdapterAuditLogQuery call :" + iEx); } catch (IllegalArgumentException iaEx) { log.error( "Thread Got Interrupted while waiting on AdapterAuditLogQuery call :" + iaEx); } retryDelay = retryDelay + retryDelay; // This is a requirement from Customer } else { log.error("Unable to call AdapterAuditLogQuery Webservice due to : " + e); throw e; } } } if (i > retryCount) { log.error("Unable to call AdapterAuditLogQuery Webservice due to : " + catchExp); throw catchExp; } } else { resp = port.findAuditEvents(request); } return resp; }