diff --git a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/client/interceptor/SoapResponseInInterceptor.java b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/client/interceptor/SoapResponseInInterceptor.java index c377ffdbd4d..bb0e8411460 100644 --- a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/client/interceptor/SoapResponseInInterceptor.java +++ b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/client/interceptor/SoapResponseInInterceptor.java @@ -86,10 +86,7 @@ public void handleMessage(SoapMessage message) throws Fault { @SuppressWarnings("unchecked") public static void addResponseMessageIdToContext(Object port, Message currentMessage) { try { - Client clientProxy = ClientProxy.getClient(port); - - Map responseContext = clientProxy.getResponseContext(); - String responseMsgId = (String) responseContext.get(NhincConstants.RESPONSE_MESSAGE_ID_KEY); + String responseMsgId = (String) getResponseContext(port).get(NhincConstants.RESPONSE_MESSAGE_ID_KEY); if (responseMsgId != null && currentMessage != null) { @@ -107,4 +104,13 @@ public static void addResponseMessageIdToContext(Object port, Message currentMes LOG.warn("Exception ", e); } } + + public static List
getResponseHeaders(Object port) { + return (List
) getResponseContext(port).get(Header.HEADER_LIST); + } + + private static Map getResponseContext(Object port) { + Client clientProxy = ClientProxy.getClient(port); + return clientProxy.getResponseContext(); + } } diff --git a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/server/BaseService.java b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/server/BaseService.java index 07c0c4aafdb..ed74e8bb51a 100644 --- a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/server/BaseService.java +++ b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/server/BaseService.java @@ -44,6 +44,7 @@ import javax.xml.ws.WebServiceContext; import javax.xml.ws.handler.MessageContext; import org.apache.commons.collections.MapUtils; +import org.apache.cxf.headers.Header; import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.jaxws.context.WrappedMessageContext; import org.apache.cxf.message.Message; @@ -60,7 +61,8 @@ public abstract class BaseService { private final AsyncMessageIdExtractor extractor = new AsyncMessageIdExtractor(); private static final Logger LOG = LoggerFactory.getLogger(BaseService.class); - private static HttpHeaderHelper headerHelper = new HttpHeaderHelper(); + private static final HttpHeaderHelper headerHelper = new HttpHeaderHelper(); + private static final ResponseHeaderHandler respHeaderHandler = new ResponseHeaderHandler(); protected AssertionType getAssertion(WebServiceContext context) { return getAssertion(context, null); @@ -84,6 +86,18 @@ protected AssertionType getAssertion(WebServiceContext context, AssertionType as return assertion; } + + protected void addSoapHeaders(Object addHeaders, WebServiceContext context) { + List
addHeadersList; + + if(addHeaders != null && addHeaders instanceof List) { + addHeadersList = (List
) addHeaders; + } else { + return; + } + + respHeaderHandler.addResponseHeadersToContext(context, addHeadersList, NhincConstants.ALLOWABLE_OUTBOUND_RESPONSE_HEADERS); + } //Extract custom http headers from message context. private void handleHttpHeaders(AssertionType assertion, WebServiceContext context) { diff --git a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/server/ResponseHeaderHandler.java b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/server/ResponseHeaderHandler.java new file mode 100644 index 00000000000..59d0edc556c --- /dev/null +++ b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/messaging/server/ResponseHeaderHandler.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2009-2018, United States Government, as represented by the Secretary of Health and Human Services. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the United States Government nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE UNITED STATES GOVERNMENT BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package gov.hhs.fha.nhinc.messaging.server; + +import gov.hhs.fha.nhinc.nhinclib.NhincConstants; +import gov.hhs.fha.nhinc.nhinclib.NullChecker; +import gov.hhs.fha.nhinc.properties.PropertyAccessException; +import gov.hhs.fha.nhinc.properties.PropertyAccessor; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import javax.xml.ws.WebServiceContext; +import org.apache.cxf.headers.Header; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author jassmit + */ +public class ResponseHeaderHandler { + + private static final Logger LOG = LoggerFactory.getLogger(ResponseHeaderHandler.class); + + public void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders, String allowableProperty) { + List
contextHeaders = (List
) context.getMessageContext().get(Header.HEADER_LIST); + if(contextHeaders == null) { + contextHeaders = new ArrayList<>(); + } + + Set allowedHeaders = getAllowedHeaders(allowableProperty); + for(Header header : responseHeaders) { + if(allowedHeaders.contains(header.getName().getLocalPart())) { + header.setDirection(Header.Direction.DIRECTION_OUT); + contextHeaders.add(header); + } + } + } + + private Set getAllowedHeaders(String allowableProperty) { + Set allowedHeaders = new HashSet<>(); + try { + allowedHeaders = getPropertyAccessor().getPropertySet(NhincConstants.GATEWAY_PROPERTY_FILE, allowableProperty); + } catch (PropertyAccessException ex) { + LOG.warn("Error accessing property file (} for property {}", NhincConstants.GATEWAY_PROPERTY_FILE, allowableProperty, ex); + } + return NullChecker.isNotNullish(allowedHeaders) ? allowedHeaders : new HashSet<>(); + } + + protected PropertyAccessor getPropertyAccessor() { + return PropertyAccessor.getInstance(); + } +} diff --git a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/nhinclib/NhincConstants.java b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/nhinclib/NhincConstants.java index d08a09a9c3e..583d0f5d93a 100644 --- a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/nhinclib/NhincConstants.java +++ b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/nhinclib/NhincConstants.java @@ -171,6 +171,8 @@ public static EXCHANGE_TYPE getExchangeType(String value) { public static final String GATEWAY_PROPERTY_FILE = "gateway"; public static final String SAML_PROPERTY_FILE = "saml"; public static final String HOME_COMMUNITY_ID_PROPERTY = "localHomeCommunityId"; + public static final String ALLOWABLE_INBOUND_RESPONSE_HEADERS = "allowableInboundResponseHeaders"; + public static final String ALLOWABLE_OUTBOUND_RESPONSE_HEADERS = "allowableOutboundResponseHeaders"; public static final String INTERNAL_CONNECTION_INFO = "InternalConnectionInfo2.xml"; public static final String DIRECTTESTING_FLAG = "DirectTesting"; public static final String MESSAGEMONITORING_DELAYINMINUTES = "MessageMonitoringDelayTime"; @@ -322,6 +324,7 @@ public static EXCHANGE_TYPE getExchangeType(String value) { public static final String WS_SOAP_HEADER_MESSAGE_ID = "MessageID"; public static final String WS_SOAP_HEADER_MESSAGE_ID_PREFIX = "urn:uuid:"; public static final String WS_SOAP_TARGET_HOME_COMMUNITY_ID = "TargetHomeCommunityID"; + public static final String SOAP_HEADERS_PROPERTY = "soapHeadersKey"; // Document Query Constants public static final String ADAPTER_DOC_QUERY_SERVICE_NAME = "adapterdocquery"; public static final String ADAPTER_DOC_QUERY_SECURED_SERVICE_NAME = "adapterdocquerysecured"; diff --git a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/properties/PropertyAccessor.java b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/properties/PropertyAccessor.java index f7ec7d63d8d..00eb9863247 100644 --- a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/properties/PropertyAccessor.java +++ b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/properties/PropertyAccessor.java @@ -133,6 +133,21 @@ public synchronized boolean getPropertyBoolean(String propertyFile, String prope return propertyFileDAO.getPropertyBoolean(propertyFile, propertyName); } + + /** + * This will return a set of properties from a comma separated list in the property file. + * + * @param propertyFile + * @param propertyName + * @return + * @throws PropertyAccessException + */ + public synchronized Set getPropertySet(String propertyFile, String propertyName) throws PropertyAccessException { + validateInput(propertyFile, propertyName); + loadPropertyFile(propertyFile); + + return propertyFileDAO.getPropertySet(propertyFile, propertyName); + } /** * This will return the long value conversion of the property. If the property value cannot be converted to a long, diff --git a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/properties/PropertyFileDAO.java b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/properties/PropertyFileDAO.java index 353605fe035..940575b1cc6 100644 --- a/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/properties/PropertyFileDAO.java +++ b/Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/properties/PropertyFileDAO.java @@ -28,10 +28,12 @@ import gov.hhs.fha.nhinc.nhinclib.NullChecker; import java.io.File; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Properties; import java.util.Set; import org.apache.commons.configuration.ConfigurationException; @@ -71,6 +73,17 @@ public void loadPropertyFile(File propertyFile, String propertyFileName) throws } } + public Set getPropertySet(String propertyFileName, String propertyName) { + PropertiesConfiguration properties = propertyFilesHashmap.get(propertyFileName); + if (properties != null && properties.containsKey(propertyName)) { + List propertyValue = properties.getList(propertyName); + if(NullChecker.isNotNullish(propertyValue)) { + return new HashSet<>(propertyValue); + } + } + return Collections.emptySet(); + } + public String getProperty(String propertyFileName, String propertyName) throws PropertyAccessException { PropertiesConfiguration properties = propertyFilesHashmap.get(propertyFileName); if (properties != null && properties.containsKey(propertyName)) { diff --git a/Product/Production/Common/Properties/src/main/resources/gateway.properties b/Product/Production/Common/Properties/src/main/resources/gateway.properties index ab739085f4b..bb8b1f47952 100644 --- a/Product/Production/Common/Properties/src/main/resources/gateway.properties +++ b/Product/Production/Common/Properties/src/main/resources/gateway.properties @@ -120,6 +120,11 @@ readHttpHeaders=false # Sets outbound http connection value to "keep-alive", default property value is false ((For True, set to True or T). connectionKeepAlive=false +# Allow for SOAP headers to be passed from NwHIN service to requesting adapter response message by adding header element names. Comma separated list. +!allowableInboundResponseHeaders=AccessDenial +# Allow for SOAP headers to be passed from responding adapter into NwHIN service response message by adding header element names. Comma separated list. +!allowableOutboundResponseHeaders=AccessDenial + # disable-cn-check should not be used for production; to enable-cn-check may required server-restart. disableCNCheck=true diff --git a/Product/Production/Gateway/DocumentQuery_20/src/main/java/gov/hhs/fha/nhinc/docquery/_20/entity/EntityDocQueryImpl.java b/Product/Production/Gateway/DocumentQuery_20/src/main/java/gov/hhs/fha/nhinc/docquery/_20/entity/EntityDocQueryImpl.java index 9666b02dd5a..58502196210 100644 --- a/Product/Production/Gateway/DocumentQuery_20/src/main/java/gov/hhs/fha/nhinc/docquery/_20/entity/EntityDocQueryImpl.java +++ b/Product/Production/Gateway/DocumentQuery_20/src/main/java/gov/hhs/fha/nhinc/docquery/_20/entity/EntityDocQueryImpl.java @@ -68,7 +68,7 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuerySecured( AssertionType assertion = getAssertion(context, null); return respondingGatewayCrossGatewayQuery(request.getAdhocQueryRequest(), assertion, - request.getNhinTargetCommunities()); + request.getNhinTargetCommunities(), context); } /** @@ -83,11 +83,11 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQueryUnsecured( RespondingGatewayCrossGatewayQueryRequestType request, WebServiceContext context) { return respondingGatewayCrossGatewayQuery(request.getAdhocQueryRequest(), request.getAssertion(), - request.getNhinTargetCommunities()); + request.getNhinTargetCommunities(), context); } private AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest request, AssertionType assertion, - NhinTargetCommunitiesType targets) { + NhinTargetCommunitiesType targets, WebServiceContext context) { AdhocQueryResponse response = null; @@ -99,7 +99,7 @@ private AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest if (StringUtils.isBlank(targets.getUseSpecVersion())) { targets.setUseSpecVersion("2.0"); } - response = outboundDocQuery.respondingGatewayCrossGatewayQuery(request, assertion, targets); + response = outboundDocQuery.respondingGatewayCrossGatewayQuery(request, assertion, targets, context); } catch (Exception e) { LOG.error("Failed to send request to Nwhin.", e); } diff --git a/Product/Production/Gateway/DocumentQuery_20/src/test/java/gov/hhs/fha/nhinc/docquery/_20/entity/EntityDocQueryImplTest.java b/Product/Production/Gateway/DocumentQuery_20/src/test/java/gov/hhs/fha/nhinc/docquery/_20/entity/EntityDocQueryImplTest.java index 13b678dbda5..f08671bf314 100644 --- a/Product/Production/Gateway/DocumentQuery_20/src/test/java/gov/hhs/fha/nhinc/docquery/_20/entity/EntityDocQueryImplTest.java +++ b/Product/Production/Gateway/DocumentQuery_20/src/test/java/gov/hhs/fha/nhinc/docquery/_20/entity/EntityDocQueryImplTest.java @@ -64,7 +64,7 @@ protected AssertionType getAssertion(WebServiceContext context, AssertionType oA impl.respondingGatewayCrossGatewayQuerySecured(request, context); verify(mockDQ).respondingGatewayCrossGatewayQuery(any(AdhocQueryRequest.class), any(AssertionType.class), - any(NhinTargetCommunitiesType.class)); + any(NhinTargetCommunitiesType.class), any(WebServiceContext.class)); verify(target).setUseSpecVersion(eq("2.0")); } diff --git a/Product/Production/Gateway/DocumentQuery_20/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/TestOutboundDocQuery.java b/Product/Production/Gateway/DocumentQuery_20/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/TestOutboundDocQuery.java index 5a7c139d4cc..0e45b824963 100644 --- a/Product/Production/Gateway/DocumentQuery_20/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/TestOutboundDocQuery.java +++ b/Product/Production/Gateway/DocumentQuery_20/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/TestOutboundDocQuery.java @@ -28,6 +28,7 @@ import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetCommunitiesType; +import javax.xml.ws.WebServiceContext; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; @@ -40,7 +41,7 @@ public class TestOutboundDocQuery implements OutboundDocQuery { @Override public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest adhocQueryRequest, - AssertionType assertion, NhinTargetCommunitiesType targets) { + AssertionType assertion, NhinTargetCommunitiesType targets, WebServiceContext context) { return new AdhocQueryResponse(); } diff --git a/Product/Production/Gateway/DocumentQuery_30/src/main/java/gov/hhs/fha/nhinc/docquery/_30/entity/EntityDocQueryImpl.java b/Product/Production/Gateway/DocumentQuery_30/src/main/java/gov/hhs/fha/nhinc/docquery/_30/entity/EntityDocQueryImpl.java index 74626e6db1a..dd2520c9d4f 100644 --- a/Product/Production/Gateway/DocumentQuery_30/src/main/java/gov/hhs/fha/nhinc/docquery/_30/entity/EntityDocQueryImpl.java +++ b/Product/Production/Gateway/DocumentQuery_30/src/main/java/gov/hhs/fha/nhinc/docquery/_30/entity/EntityDocQueryImpl.java @@ -68,7 +68,7 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuerySecured( AssertionType assertion = getAssertion(context, null); return respondingGatewayCrossGatewayQuery(request.getAdhocQueryRequest(), assertion, - request.getNhinTargetCommunities()); + request.getNhinTargetCommunities(), context); } /** @@ -83,11 +83,11 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQueryUnsecured( RespondingGatewayCrossGatewayQueryRequestType request, WebServiceContext context) { return respondingGatewayCrossGatewayQuery(request.getAdhocQueryRequest(), request.getAssertion(), - request.getNhinTargetCommunities()); + request.getNhinTargetCommunities(), context); } private AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest request, AssertionType assertion, - NhinTargetCommunitiesType targets) { + NhinTargetCommunitiesType targets, WebServiceContext context) { AdhocQueryResponse response = null; @@ -99,7 +99,7 @@ private AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest if (StringUtils.isBlank(targets.getUseSpecVersion())) { targets.setUseSpecVersion("3.0"); } - response = outboundDocQuery.respondingGatewayCrossGatewayQuery(request, assertion, targets); + response = outboundDocQuery.respondingGatewayCrossGatewayQuery(request, assertion, targets, context); } catch (Exception e) { LOG.error("Failed to send request to Nwhin.", e); } diff --git a/Product/Production/Gateway/DocumentQuery_30/src/main/java/gov/hhs/fha/nhinc/docquery/_30/nhin/DocQueryImpl.java b/Product/Production/Gateway/DocumentQuery_30/src/main/java/gov/hhs/fha/nhinc/docquery/_30/nhin/DocQueryImpl.java index c30bf5953fb..8231e6237d4 100644 --- a/Product/Production/Gateway/DocumentQuery_30/src/main/java/gov/hhs/fha/nhinc/docquery/_30/nhin/DocQueryImpl.java +++ b/Product/Production/Gateway/DocumentQuery_30/src/main/java/gov/hhs/fha/nhinc/docquery/_30/nhin/DocQueryImpl.java @@ -29,7 +29,9 @@ import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.docquery.inbound.InboundDocQuery; import gov.hhs.fha.nhinc.messaging.server.BaseService; +import gov.hhs.fha.nhinc.nhinclib.NhincConstants; import gov.hhs.fha.nhinc.nhinclib.NhincConstants.UDDI_SPEC_VERSION; +import java.util.Properties; import javax.xml.ws.WebServiceContext; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; @@ -47,7 +49,12 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest b if (assertion != null) { assertion.setImplementsSpecVersion(UDDI_SPEC_VERSION.SPEC_3_0.toString()); } + + Properties webContextProperties = getWebContextProperties(context); - return inboundDocQuery.respondingGatewayCrossGatewayQuery(body, assertion, getWebContextProperties(context)); + AdhocQueryResponse response = inboundDocQuery.respondingGatewayCrossGatewayQuery(body, assertion, webContextProperties); + addSoapHeaders(webContextProperties.get(NhincConstants.SOAP_HEADERS_PROPERTY), context); + + return response; } } diff --git a/Product/Production/Gateway/DocumentQuery_30/src/test/java/gov/hhs/fha/nhinc/docquery/_30/entity/EntityDocQueryImplTest.java b/Product/Production/Gateway/DocumentQuery_30/src/test/java/gov/hhs/fha/nhinc/docquery/_30/entity/EntityDocQueryImplTest.java index 83ad4d0f1ef..496c8d99727 100644 --- a/Product/Production/Gateway/DocumentQuery_30/src/test/java/gov/hhs/fha/nhinc/docquery/_30/entity/EntityDocQueryImplTest.java +++ b/Product/Production/Gateway/DocumentQuery_30/src/test/java/gov/hhs/fha/nhinc/docquery/_30/entity/EntityDocQueryImplTest.java @@ -64,7 +64,7 @@ protected AssertionType getAssertion(WebServiceContext context, AssertionType oA impl.respondingGatewayCrossGatewayQuerySecured(request, context); verify(mockDQ).respondingGatewayCrossGatewayQuery(any(AdhocQueryRequest.class), any(AssertionType.class), - any(NhinTargetCommunitiesType.class)); + any(NhinTargetCommunitiesType.class), any(WebServiceContext.class)); verify(target).setUseSpecVersion(eq("3.0")); } diff --git a/Product/Production/Gateway/DocumentQuery_30/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/TestOutboundDocQuery.java b/Product/Production/Gateway/DocumentQuery_30/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/TestOutboundDocQuery.java index 5a7c139d4cc..0e45b824963 100644 --- a/Product/Production/Gateway/DocumentQuery_30/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/TestOutboundDocQuery.java +++ b/Product/Production/Gateway/DocumentQuery_30/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/TestOutboundDocQuery.java @@ -28,6 +28,7 @@ import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetCommunitiesType; +import javax.xml.ws.WebServiceContext; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; @@ -40,7 +41,7 @@ public class TestOutboundDocQuery implements OutboundDocQuery { @Override public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest adhocQueryRequest, - AssertionType assertion, NhinTargetCommunitiesType targets) { + AssertionType assertion, NhinTargetCommunitiesType targets, WebServiceContext context) { return new AdhocQueryResponse(); } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxy.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxy.java index a5d6aa56a81..a5d4269605f 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxy.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxy.java @@ -27,6 +27,7 @@ package gov.hhs.fha.nhinc.docquery.adapter.proxy; import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; +import java.util.Properties; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; @@ -40,5 +41,5 @@ public interface AdapterDocQueryProxy { * @param assertion Assertion received. * @return AdhocQueryResponse. */ - AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest msg, AssertionType assertion); + AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest msg, AssertionType assertion, Properties webContextProperties); } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyJavaImpl.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyJavaImpl.java index 7dc67c77af1..829c4e2e53a 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyJavaImpl.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyJavaImpl.java @@ -31,6 +31,7 @@ import gov.hhs.fha.nhinc.docquery.adapter.AdapterDocQueryOrchImpl; import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryRequestDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; +import java.util.Properties; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; import org.slf4j.Logger; @@ -52,7 +53,7 @@ public class AdapterDocQueryProxyJavaImpl implements AdapterDocQueryProxy { afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "") @Override - public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest msg, AssertionType assertion) { + public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest msg, AssertionType assertion, Properties webContextProperties) { LOG.debug("Using Java Implementation for Adapter Doc Query Service"); return new AdapterDocQueryOrchImpl().respondingGatewayCrossGatewayQuery(msg, assertion); } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyNoOpImpl.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyNoOpImpl.java index 3465f714bf9..0267dc0e875 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyNoOpImpl.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyNoOpImpl.java @@ -31,6 +31,7 @@ import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryRequestDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; import gov.hhs.fha.nhinc.document.DocumentConstants; +import java.util.Properties; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; import oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType; @@ -58,7 +59,7 @@ public class AdapterDocQueryProxyNoOpImpl implements AdapterDocQueryProxy { afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "") @Override - public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest msg, AssertionType assertion) { + public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest msg, AssertionType assertion, Properties webContextProperties) { LOG.debug("Using NoOp Implementation for Adapter Doc Query Service"); AdhocQueryResponse response = new AdhocQueryResponse(); response.setRegistryObjectList(new RegistryObjectListType()); diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceSecuredImpl.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceSecuredImpl.java index 5a1512d9a23..7900268c4bf 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceSecuredImpl.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceSecuredImpl.java @@ -34,11 +34,15 @@ import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; import gov.hhs.fha.nhinc.messaging.client.CONNECTClient; import gov.hhs.fha.nhinc.messaging.client.CONNECTClientFactory; +import gov.hhs.fha.nhinc.messaging.client.interceptor.SoapResponseInInterceptor; import gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor; import gov.hhs.fha.nhinc.nhinclib.NhincConstants; import gov.hhs.fha.nhinc.nhinclib.NullChecker; +import java.util.List; +import java.util.Properties; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; +import org.apache.cxf.headers.Header; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,12 +69,13 @@ public ServicePortDescriptor getServicePortDescr * * @param msg The AdhocQueryRequest message. * @param assertion Assertion received. + * @param webContextProperties * @return AdhocQuery Response from Adapter interface. */ @AdapterDelegationEvent(beforeBuilder = AdhocQueryRequestDescriptionBuilder.class, afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "") @Override public AdhocQueryResponse respondingGatewayCrossGatewayQuery(final AdhocQueryRequest msg, - final AssertionType assertion) { + final AssertionType assertion, Properties webContextProperties) { AdhocQueryResponse response = null; String url; try { @@ -91,6 +96,8 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuery(final AdhocQueryReq response = (AdhocQueryResponse) client.invokePort(AdapterDocQuerySecuredPortType.class, "respondingGatewayCrossGatewayQuery", msg); + + addResponseHeaders(SoapResponseInInterceptor.getResponseHeaders(client.getPort()), webContextProperties); } } else { LOG.error("Failed to call the web service (" + NhincConstants.ADAPTER_DOC_QUERY_SECURED_SERVICE_NAME @@ -103,4 +110,10 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuery(final AdhocQueryReq return response; } + + private static void addResponseHeaders(List
headers, Properties webContextProperties) { + webContextProperties.put(NhincConstants.SOAP_HEADERS_PROPERTY, headers); + } + + } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceUnsecuredImpl.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceUnsecuredImpl.java index feb46989d47..6b8ce00c0c8 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceUnsecuredImpl.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceUnsecuredImpl.java @@ -35,11 +35,15 @@ import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; import gov.hhs.fha.nhinc.messaging.client.CONNECTClient; import gov.hhs.fha.nhinc.messaging.client.CONNECTClientFactory; +import gov.hhs.fha.nhinc.messaging.client.interceptor.SoapResponseInInterceptor; import gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor; import gov.hhs.fha.nhinc.nhinclib.NhincConstants; import gov.hhs.fha.nhinc.nhinclib.NullChecker; +import java.util.List; +import java.util.Properties; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; +import org.apache.cxf.headers.Header; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,22 +60,24 @@ public class AdapterDocQueryProxyWebServiceUnsecuredImpl extends BaseAdapterDocQ * @return Adapter Apilevel to be implemented (a0 or a1). */ public ServicePortDescriptor getServicePortDescriptor( - NhincConstants.ADAPTER_API_LEVEL apiLevel) { + NhincConstants.ADAPTER_API_LEVEL apiLevel) { return new AdapterDocQueryServicePortDescriptor(); } /** - * The respondingGatewayCrossGatewayQuery method returns AdhocQueryResponse from Adapter interface. + * The respondingGatewayCrossGatewayQuery method returns AdhocQueryResponse + * from Adapter interface. * * @param msg The AdhocQueryRequest message. * @param assertion Assertion received. * @return AdhocQuery Response from Adapter interface. */ @AdapterDelegationEvent(beforeBuilder = AdhocQueryRequestDescriptionBuilder.class, - afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", - version = "") + afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", + version = "") @Override - public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest msg, AssertionType assertion) { + public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest msg, AssertionType assertion, + Properties webContextProperties) { LOG.debug("Begin respondingGatewayCrossGatewayQuery"); AdhocQueryResponse response = null; String url; @@ -92,14 +98,16 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest m ServicePortDescriptor portDescriptor = getServicePortDescriptor(NhincConstants.ADAPTER_API_LEVEL.LEVEL_a0); CONNECTClient client = CONNECTClientFactory.getInstance() - .getCONNECTClientUnsecured(portDescriptor, url, assertion); + .getCONNECTClientUnsecured(portDescriptor, url, assertion); response = (AdhocQueryResponse) client.invokePort(AdapterDocQueryPortType.class, - "respondingGatewayCrossGatewayQuery", request); + "respondingGatewayCrossGatewayQuery", request); + + addResponseHeaders(SoapResponseInInterceptor.getResponseHeaders(client.getPort()), webContextProperties); } } else { LOG.error("Failed to call the web service (" + NhincConstants.ADAPTER_DOC_QUERY_SERVICE_NAME - + "). The URL is null."); + + "). The URL is null."); } } catch (Exception ex) { LOG.error("Error sending Adapter Doc Query Unsecured message: " + ex.getMessage(), ex); @@ -109,4 +117,8 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest m LOG.debug("End respondingGatewayCrossGatewayQuery"); return response; } + + private static void addResponseHeaders(List
headers, Properties webContextProperties) { + webContextProperties.put(NhincConstants.SOAP_HEADERS_PROPERTY, headers); + } } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryAggregator.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryAggregator.java index 78f6c0a2a29..3858e689f82 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryAggregator.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryAggregator.java @@ -31,11 +31,13 @@ import gov.hhs.fha.nhinc.orchestration.NhinAggregator; import gov.hhs.fha.nhinc.orchestration.OutboundOrchestratable; import java.math.BigInteger; +import java.util.List; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; import oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType; import oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotListType; import oasis.names.tc.ebxml_regrep.xsd.rs._3.RegistryErrorList; import org.apache.commons.collections.CollectionUtils; +import org.apache.cxf.headers.Header; /** * @author bhumphrey @@ -175,6 +177,7 @@ public void aggregate(OutboundDocQueryOrchestratable to, OutboundDocQueryOrchest DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE); } aggregate(to.getResponse(), singleResponse); + aggregateHeaders(to.getResponseHeaders(), from.getResponseHeaders()); } /* @@ -215,4 +218,8 @@ private void initializeResponse(OutboundDocQueryOrchestratable aggregatedOrchest } + private static void aggregateHeaders(List
aggregateHeaders, List
singleResponseHeaders) { + aggregateHeaders.addAll(singleResponseHeaders); + } + } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryOrchestratable.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryOrchestratable.java index ad2e2b154b1..7937c738f57 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryOrchestratable.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryOrchestratable.java @@ -34,8 +34,11 @@ import gov.hhs.fha.nhinc.orchestration.OutboundOrchestratableMessage; import gov.hhs.fha.nhinc.orchestration.OutboundResponseProcessor; import gov.hhs.fha.nhinc.orchestration.PolicyTransformer; +import java.util.ArrayList; +import java.util.List; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; +import org.apache.cxf.headers.Header; /** * Doc Query implementation of OutboundOrchestratableMessage. @@ -54,6 +57,7 @@ public class OutboundDocQueryOrchestratable implements OutboundOrchestratableMes private AdhocQueryResponse response = null; private NhinAggregator aggregator = null; + private List
responseHeaders = new ArrayList<>(); /** * Default Constructor. @@ -100,6 +104,14 @@ public OutboundDocQueryOrchestratable(NhinAggregator agg, AssertionType a, Strin this(null, null, a, name, null, r); this.aggregator = agg; } + + public void addHeader(Header header) { + responseHeaders.add(header); + } + + public List
getResponseHeaders(){ + return responseHeaders; + } /** * @param assertion Assertion received. diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryStrategy.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryStrategy.java index d73751c18e7..2f38445869c 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryStrategy.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/entity/OutboundDocQueryStrategy.java @@ -126,7 +126,7 @@ public void executeStrategy(OutboundDocQueryOrchestratable message) throws Illeg AdhocQueryResponse response; response = proxyFactory.getNhinDocQueryProxy().respondingGatewayCrossGatewayQuery(message.getRequest(), - message.getAssertion(), message.getTarget()); + message.getAssertion(), message.getTarget(), message.getResponseHeaders()); message.setResponse(response); diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/inbound/PassthroughInboundDocQuery.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/inbound/PassthroughInboundDocQuery.java index 560ae91c16c..8b6bbb40f90 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/inbound/PassthroughInboundDocQuery.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/inbound/PassthroughInboundDocQuery.java @@ -65,7 +65,7 @@ public AdhocQueryResponse processDocQuery(AdhocQueryRequest msg, AssertionType a AdapterDocQueryProxy adapterProxy = adapterFactory.getAdapterDocQueryProxy(); - return adapterProxy.respondingGatewayCrossGatewayQuery(msg, assertion); + return adapterProxy.respondingGatewayCrossGatewayQuery(msg, assertion, webContextProperties); } } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/inbound/StandardInboundDocQuery.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/inbound/StandardInboundDocQuery.java index f813a00da25..9b2f087de36 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/inbound/StandardInboundDocQuery.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/inbound/StandardInboundDocQuery.java @@ -101,7 +101,7 @@ public AdhocQueryResponse processDocQuery(AdhocQueryRequest msg, AssertionType a AdhocQueryResponse resp; if (isPolicyValid(msg, assertion)) { - resp = sendToAdapter(msg, assertion); + resp = sendToAdapter(msg, assertion, webContextProperties); } else { resp = MessageGeneratorUtils.getInstance().createPolicyErrorResponse(); } @@ -113,8 +113,8 @@ private boolean isPolicyValid(AdhocQueryRequest msg, AssertionType assertion) { return policyChecker.checkIncomingPolicy(msg, assertion); } - private AdhocQueryResponse sendToAdapter(AdhocQueryRequest msg, AssertionType assertion) { - return adapterFactory.getAdapterDocQueryProxy().respondingGatewayCrossGatewayQuery(msg, assertion); + private AdhocQueryResponse sendToAdapter(AdhocQueryRequest msg, AssertionType assertion, Properties webContextProperties) { + return adapterFactory.getAdapterDocQueryProxy().respondingGatewayCrossGatewayQuery(msg, assertion, webContextProperties); } protected String getLocalHomeCommunityId() { diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxy.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxy.java index 40d3c92b46d..e9fb2279a55 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxy.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxy.java @@ -28,8 +28,10 @@ import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetSystemType; +import java.util.List; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; +import org.apache.cxf.headers.Header; /** * @@ -42,9 +44,10 @@ public interface NhinDocQueryProxy { * @param request Document Query Request received. * @param assertion Assertion received. * @param target NhinTargetCommunities to send DocQueryRequest. + * @param headers * @throws Exception Throws Exception. * @return List of Documents that match the search criteria. */ AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest request, AssertionType assertion, - NhinTargetSystemType target) throws Exception; + NhinTargetSystemType target, List
headers) throws Exception; } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpImpl.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpImpl.java index 735a3d69359..b33b9bddce7 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpImpl.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpImpl.java @@ -32,9 +32,11 @@ import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryRequestDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; import gov.hhs.fha.nhinc.document.DocumentConstants; +import java.util.List; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; import oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType; +import org.apache.cxf.headers.Header; /** * @@ -51,6 +53,7 @@ public class NhinDocQueryProxyNoOpImpl implements NhinDocQueryProxy { * Assertion received. * @param target * NhinTargetCommunities to send DocQueryRequest. + * @param responseHeaders * @return null AdhocQuery Response since this does not send Query request. */ @NwhinInvocationEvent(beforeBuilder = AdhocQueryRequestDescriptionBuilder.class, @@ -58,7 +61,7 @@ public class NhinDocQueryProxyNoOpImpl implements NhinDocQueryProxy { version = "") @Override public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest request, AssertionType assertion, - NhinTargetSystemType target) { + NhinTargetSystemType target, List
responseHeaders) { AdhocQueryResponse response = new AdhocQueryResponse(); response.setRegistryObjectList(new RegistryObjectListType()); response.setStatus(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_SUCCESS); diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyWebServiceSecuredImpl.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyWebServiceSecuredImpl.java index 3ff307b74b8..fa951285292 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyWebServiceSecuredImpl.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyWebServiceSecuredImpl.java @@ -36,6 +36,7 @@ import gov.hhs.fha.nhinc.exchangemgr.ExchangeManagerException; import gov.hhs.fha.nhinc.messaging.client.CONNECTClient; import gov.hhs.fha.nhinc.messaging.client.CONNECTClientFactory; +import gov.hhs.fha.nhinc.messaging.client.interceptor.SoapResponseInInterceptor; import gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor; import gov.hhs.fha.nhinc.nhinclib.NhincConstants; import gov.hhs.fha.nhinc.nhinclib.NhincConstants.UDDI_SPEC_VERSION; @@ -44,12 +45,14 @@ import gov.hhs.fha.nhinc.xdcommon.XDCommonResponseHelper; import gov.hhs.fha.nhinc.xdcommon.XDCommonResponseHelper.ErrorCodes; import ihe.iti.xds_b._2007.RespondingGatewayQueryPortType; +import java.util.List; import javax.xml.ws.WebServiceException; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; import oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType; import oasis.names.tc.ebxml_regrep.xsd.rs._3.RegistryResponseType; import org.apache.commons.lang.StringUtils; +import org.apache.cxf.headers.Header; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,20 +73,21 @@ protected WebServiceProxyHelper createWebServiceProxyHelper() { } /** - * @param apiLevel The gateway apiLevel to be implemented for webService (g0,g1) - * @return NhinDocQueryServicePortDescriptor Comprises of NameSpaceUri,ServiceName,Port,WSDLFile and - * WSAddressingAction. + * @param apiLevel The gateway apiLevel to be implemented for webService + * (g0,g1) + * @return NhinDocQueryServicePortDescriptor Comprises of + * NameSpaceUri,ServiceName,Port,WSDLFile and WSAddressingAction. */ public ServicePortDescriptor getServicePortDescriptor( - final NhincConstants.GATEWAY_API_LEVEL apiLevel) { + final NhincConstants.GATEWAY_API_LEVEL apiLevel) { return new NhinDocQueryServicePortDescriptor(); } public CONNECTClient getCONNECTClientSecured( - final ServicePortDescriptor portDescriptor, final AssertionType assertion, - final String url, final NhinTargetSystemType target) { + final ServicePortDescriptor portDescriptor, final AssertionType assertion, + final String url, final NhinTargetSystemType target) { return CONNECTClientFactory.getInstance().getCONNECTClientSecured(portDescriptor, assertion, url, - target.getHomeCommunity().getHomeCommunityId(), NhincConstants.DOC_QUERY_SERVICE_NAME); + target.getHomeCommunity().getHomeCommunityId(), NhincConstants.DOC_QUERY_SERVICE_NAME); } protected ExchangeManager getCMInstance() { @@ -100,10 +104,10 @@ protected ExchangeManager getCMInstance() { * @return The AdhocQUery response from the web service. */ @NwhinInvocationEvent(beforeBuilder = AdhocQueryRequestDescriptionBuilder.class, afterReturningBuilder - = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "") + = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "") @Override public AdhocQueryResponse respondingGatewayCrossGatewayQuery(final AdhocQueryRequest request, - final AssertionType assertion, final NhinTargetSystemType target) throws Exception { + final AssertionType assertion, final NhinTargetSystemType target, List
headers) throws Exception { AdhocQueryResponse response; try { String url = target.getUrl(); @@ -113,47 +117,47 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuery(final AdhocQueryReq } final UDDI_SPEC_VERSION version = UDDI_SPEC_VERSION.fromString(target.getUseSpecVersion()); url = getCMInstance().getEndpointURL( - target.getHomeCommunity().getHomeCommunityId(), NhincConstants.DOC_QUERY_SERVICE_NAME, version); + target.getHomeCommunity().getHomeCommunityId(), NhincConstants.DOC_QUERY_SERVICE_NAME, version); LOG.debug("After target system URL look up. URL for service: " + NhincConstants.DOC_QUERY_SERVICE_NAME - + " is: " + url); + + " is: " + url); } final ServicePortDescriptor portDescriptor = getServicePortDescriptor( - NhincConstants.GATEWAY_API_LEVEL.LEVEL_g0); + NhincConstants.GATEWAY_API_LEVEL.LEVEL_g0); final CONNECTClient client = getCONNECTClientSecured(portDescriptor, - assertion, url, target); + assertion, url, target); response = (AdhocQueryResponse) client.invokePort(RespondingGatewayQueryPortType.class, - "respondingGatewayCrossGatewayQuery", request); + "respondingGatewayCrossGatewayQuery", request); + addResponseHeaders(headers, client.getPort()); } catch (final ExchangeManagerException e) { LOG.error("Error calling respondingGatewayCrossGatewayQuery", e); - final XDCommonResponseHelper helper = new XDCommonResponseHelper(); - final RegistryResponseType registryError = helper.createError(e.getLocalizedMessage(), - ErrorCodes.XDSRepositoryError, NhincConstants.INIT_MULTISPEC_LOC_ENTITY_DR); - - response = new AdhocQueryResponse(); - response.setRegistryObjectList(new RegistryObjectListType()); - response.setStatus(registryError.getStatus()); - response.setRegistryErrorList(registryError.getRegistryErrorList()); - + response = buildErrorResponse(e.getLocalizedMessage()); } catch (final WebServiceException wse) { LOG.error("Error calling respondingGatewayCrossGatewayQuery", wse); - final XDCommonResponseHelper helper = new XDCommonResponseHelper(); - final String endpointAvailableError = NhincConstants.INIT_MULTISPEC_ERROR_NO_ENDPOINT_AVAILABLE - + target.getHomeCommunity().getHomeCommunityId() + "."; - final RegistryResponseType registryError = helper.createError(endpointAvailableError, - ErrorCodes.XDSRegistryError, NhincConstants.INIT_MULTISPEC_LOC_ENTITY_DQ); - response = new AdhocQueryResponse(); - response.setRegistryObjectList(new RegistryObjectListType()); - response.setStatus(registryError.getStatus()); - response.setRegistryErrorList(registryError.getRegistryErrorList()); - + response = buildErrorResponse(NhincConstants.INIT_MULTISPEC_ERROR_NO_ENDPOINT_AVAILABLE + + target.getHomeCommunity().getHomeCommunityId() + "."); } catch (final Exception ex) { LOG.error("Error calling respondingGatewayCrossGatewayQuery", ex); throw ex; } return response; } + + protected void addResponseHeaders(List
responseHeaders, Object port) { + responseHeaders.addAll(SoapResponseInInterceptor.getResponseHeaders(port)); + } + + private static AdhocQueryResponse buildErrorResponse(String message) { + final XDCommonResponseHelper helper = new XDCommonResponseHelper(); + final RegistryResponseType registryError = helper.createError(message, + ErrorCodes.XDSRegistryError, NhincConstants.INIT_MULTISPEC_LOC_ENTITY_DQ); + AdhocQueryResponse response = new AdhocQueryResponse(); + response.setRegistryObjectList(new RegistryObjectListType()); + response.setStatus(registryError.getStatus()); + response.setRegistryErrorList(registryError.getRegistryErrorList()); + return response; + } } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/OutboundDocQuery.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/OutboundDocQuery.java index a8f5578675f..56c0dfcb312 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/OutboundDocQuery.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/OutboundDocQuery.java @@ -28,6 +28,7 @@ import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetCommunitiesType; +import javax.xml.ws.WebServiceContext; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; @@ -38,6 +39,6 @@ public interface OutboundDocQuery { public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest adhocQueryRequest, - AssertionType assertion, NhinTargetCommunitiesType targets); + AssertionType assertion, NhinTargetCommunitiesType targets, WebServiceContext context); } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/PassthroughOutboundDocQuery.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/PassthroughOutboundDocQuery.java index 55fd61f9de6..d1c0461217b 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/PassthroughOutboundDocQuery.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/PassthroughOutboundDocQuery.java @@ -34,10 +34,14 @@ import gov.hhs.fha.nhinc.docquery.audit.DocQueryAuditLogger; import gov.hhs.fha.nhinc.docquery.entity.OutboundDocQueryDelegate; import gov.hhs.fha.nhinc.docquery.entity.OutboundDocQueryOrchestratable; +import gov.hhs.fha.nhinc.messaging.server.ResponseHeaderHandler; import gov.hhs.fha.nhinc.nhinclib.NhincConstants; import java.util.Iterator; +import java.util.List; +import javax.xml.ws.WebServiceContext; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; +import org.apache.cxf.headers.Header; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,6 +49,7 @@ public class PassthroughOutboundDocQuery implements OutboundDocQuery { private static final Logger LOG = LoggerFactory.getLogger(PassthroughOutboundDocQuery.class); private OutboundDocQueryDelegate delegate = new OutboundDocQueryDelegate(); + private static final ResponseHeaderHandler respHeaderHandler = new ResponseHeaderHandler(); public PassthroughOutboundDocQuery() { super(); @@ -59,12 +64,14 @@ public PassthroughOutboundDocQuery(OutboundDocQueryDelegate delegate) { * * @param request the AdhocQueryRequest message to be sent * @param assertion the AssertionType instance received from the adapter - * @param targets NhinTargetCommunitiesType where DocQuery Request is to be sent. Only the first one is used. + * @param targets NhinTargetCommunitiesType where DocQuery Request is to be + * sent. Only the first one is used. + * @param context * @return AdhocQueryResponse received from the NHIN */ @Override public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest request, AssertionType assertion, - NhinTargetCommunitiesType targets) { + NhinTargetCommunitiesType targets, WebServiceContext context) { NhinTargetSystemType target = MessageGeneratorUtils.getInstance().convertFirstToNhinTargetSystemType(targets); String targetHCID = getTargetHCID(target); @@ -74,7 +81,7 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest r } return sendRequestToNwhin(request, MessageGeneratorUtils.getInstance().generateMessageId( - assertion), target, targetHCID); + assertion), target, targetHCID, context); } private String getTargetHCID(NhinTargetSystemType target) { @@ -87,16 +94,17 @@ private String getTargetHCID(NhinTargetSystemType target) { } private AdhocQueryResponse sendRequestToNwhin(AdhocQueryRequest request, AssertionType assertion, - NhinTargetSystemType target, String targetCommunityID) { + NhinTargetSystemType target, String targetCommunityID, WebServiceContext context) { AdhocQueryResponse response; try { auditRequest(request, assertion, target); OutboundDocQueryOrchestratable orchestratable = new OutboundDocQueryOrchestratable(delegate, null, - assertion, NhincConstants.DOC_QUERY_SERVICE_NAME, target, request); - response = delegate.process(orchestratable).getResponse(); - + assertion, NhincConstants.DOC_QUERY_SERVICE_NAME, target, request); + OutboundDocQueryOrchestratable orchResponse = delegate.process(orchestratable); + response = orchResponse.getResponse(); + addResponseHeadersToContext(context, orchResponse.getResponseHeaders()); } catch (Exception ex) { String errorMsg = "Error from target homeId = " + targetCommunityID + ". " + ex.getMessage(); response = MessageGeneratorUtils.getInstance().createRepositoryErrorResponse(errorMsg); @@ -109,7 +117,7 @@ private AdhocQueryResponse sendRequestToNwhin(AdhocQueryRequest request, Asserti private void warnTooManyTargets(String targetHCID, NhinTargetCommunitiesType targets) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Multiple targets in request message in passthrough mode. Only sending to target HCID: ") - .append(targetHCID).append(". Not sending request to: "); + .append(targetHCID).append(". Not sending request to: "); Iterator communityIterator = targets.getNhinTargetCommunity().iterator(); Boolean first = true; @@ -139,10 +147,14 @@ protected void logWarning(String warning) { private void auditRequest(AdhocQueryRequest request, AssertionType assertion, NhinTargetSystemType target) { getAuditLogger().auditRequestMessage(request, assertion, target, NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, - NhincConstants.AUDIT_LOG_NHIN_INTERFACE, Boolean.TRUE, null, NhincConstants.DOC_QUERY_SERVICE_NAME); + NhincConstants.AUDIT_LOG_NHIN_INTERFACE, Boolean.TRUE, null, NhincConstants.DOC_QUERY_SERVICE_NAME); } protected DocQueryAuditLogger getAuditLogger() { return new DocQueryAuditLogger(); } + + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders) { + respHeaderHandler.addResponseHeadersToContext(context, responseHeaders, NhincConstants.ALLOWABLE_INBOUND_RESPONSE_HEADERS); + } } diff --git a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/StandardOutboundDocQuery.java b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/StandardOutboundDocQuery.java index 87cf404e52a..dbe12f7507b 100644 --- a/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/StandardOutboundDocQuery.java +++ b/Product/Production/Services/DocumentQueryCore/src/main/java/gov/hhs/fha/nhinc/docquery/outbound/StandardOutboundDocQuery.java @@ -41,24 +41,28 @@ import gov.hhs.fha.nhinc.docquery.entity.OutboundDocQueryAggregator; import gov.hhs.fha.nhinc.docquery.entity.OutboundDocQueryOrchestratable; import gov.hhs.fha.nhinc.document.DocumentConstants; +import gov.hhs.fha.nhinc.messaging.server.ResponseHeaderHandler; import gov.hhs.fha.nhinc.nhinclib.NhincConstants; import gov.hhs.fha.nhinc.orchestration.OutboundOrchestratable; import gov.hhs.fha.nhinc.util.HomeCommunityMap; import java.util.ArrayList; import java.util.List; +import javax.xml.ws.WebServiceContext; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; +import org.apache.cxf.headers.Header; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class StandardOutboundDocQuery implements OutboundDocQuery { private static final Logger LOG = LoggerFactory.getLogger(StandardOutboundDocQuery.class); + private static final ResponseHeaderHandler respHeaderHandler = new ResponseHeaderHandler(); private AggregationStrategy strategy; private AggregationService fanoutService; private DocQueryAuditLogger auditLogger = null; private DocQueryPolicyChecker policyChecker; - + /** * Add default constructor that is used by test cases Note that implementations should always use constructor that * takes the executor services as input. @@ -83,12 +87,13 @@ public StandardOutboundDocQuery() { * @param adhocQueryRequest The AdhocQueryRequest message received. * @param assertion Assertion received. * @param targets Target to send request. + * @param context * @return AdhocQueryResponse from Entity Interface. */ @Override @OutboundProcessingEvent(beforeBuilder = AdhocQueryRequestDescriptionBuilder.class, afterReturningBuilder = AdhocQueryResponseDescriptionBuilder.class, serviceType = "Document Query", version = "") public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest adhocQueryRequest, - AssertionType assertion, NhinTargetCommunitiesType targets) { + AssertionType assertion, NhinTargetCommunitiesType targets, WebServiceContext context) { LOG.trace("EntityDocQueryOrchImpl.respondingGatewayCrossGatewayQuery..."); AdhocQueryResponse response; @@ -126,6 +131,7 @@ public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest a strategy.execute(aggregate); response = request.getResponse(); + addResponseHeadersToContext(context, request.getResponseHeaders()); } else { response = new AdhocQueryResponse(); response.setStatus(NhincConstants.NHINC_ADHOC_QUERY_SUCCESS_RESPONSE); @@ -169,4 +175,8 @@ private void auditRequest(AdhocQueryRequest request, AssertionType assertion, Nh protected String getSenderHcid() { return HomeCommunityMap.getLocalHomeCommunityId(); } + + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders) { + respHeaderHandler.addResponseHeadersToContext(context, responseHeaders, NhincConstants.ALLOWABLE_INBOUND_RESPONSE_HEADERS); + } } diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyNoOpImplTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyNoOpImplTest.java index ffd4115987a..1426eb6c791 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyNoOpImplTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyNoOpImplTest.java @@ -35,7 +35,7 @@ public class AdapterDocQueryProxyNoOpImplTest { @Test public void errorResponseHasRegistryObjectList() throws Exception { AdapterDocQueryProxyNoOpImpl impl = new AdapterDocQueryProxyNoOpImpl(); - AdhocQueryResponse response = impl.respondingGatewayCrossGatewayQuery(null, null); + AdhocQueryResponse response = impl.respondingGatewayCrossGatewayQuery(null, null, null); AdhocQueryResponseAsserter.assertSchemaCompliant(response); } } diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceImplsTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceImplsTest.java index 262f6b17241..93b1e2d47af 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceImplsTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryProxyWebServiceImplsTest.java @@ -65,7 +65,7 @@ public void adapterHelperCreatesErrorResponse() throws Exception { impl.setWebServiceProxyHelper(proxyMock); AdapterHelper helper = mock(AdapterHelper.class); impl.setAdapterHelper(helper); - AdhocQueryResponse response = impl.respondingGatewayCrossGatewayQuery(null, null); + AdhocQueryResponse response = impl.respondingGatewayCrossGatewayQuery(null, null, null); assertEquals(response, helper.createErrorResponse()); } } diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryWebServiceProxyTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryWebServiceProxyTest.java index b4b5282d684..eac86317e7d 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryWebServiceProxyTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/adapter/proxy/AdapterDocQueryWebServiceProxyTest.java @@ -31,6 +31,7 @@ import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryRequestDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; import java.lang.reflect.Method; +import java.util.Properties; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -52,7 +53,7 @@ public void hasAdapterDelegationEvent() throws Exception { private void assertAdapterDelegationEvent(Class clazz) throws NoSuchMethodException { Method method = clazz.getMethod("respondingGatewayCrossGatewayQuery", AdhocQueryRequest.class, - AssertionType.class); + AssertionType.class, Properties.class); AdapterDelegationEvent annotation = method.getAnnotation(AdapterDelegationEvent.class); assertNotNull(annotation); assertEquals(AdhocQueryRequestDescriptionBuilder.class, annotation.beforeBuilder()); diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/InboundDocQueryTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/InboundDocQueryTest.java index e07f37afed2..856ddff434f 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/InboundDocQueryTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/InboundDocQueryTest.java @@ -106,12 +106,12 @@ protected void verifyInboundDocQuery(AssertionType assertion, String sendingHcid any(DocQueryAuditTransforms.class)); } - protected AdapterDocQueryProxyObjectFactory getMockAdapterFactory(AssertionType assertion) { + protected AdapterDocQueryProxyObjectFactory getMockAdapterFactory(AssertionType assertion, Properties webContextProperties) { AdapterDocQueryProxyObjectFactory mockAdapterFactory = mock(AdapterDocQueryProxyObjectFactory.class); AdapterDocQueryProxy mockAdapterProxy = mock(AdapterDocQueryProxy.class); when(mockAdapterFactory.getAdapterDocQueryProxy()).thenReturn(mockAdapterProxy); - when(mockAdapterProxy.respondingGatewayCrossGatewayQuery(request, assertion)).thenReturn(expectedResponse); + when(mockAdapterProxy.respondingGatewayCrossGatewayQuery(request, assertion, webContextProperties)).thenReturn(expectedResponse); return mockAdapterFactory; } diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/PassthroughInboundDocQueryTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/PassthroughInboundDocQueryTest.java index 7ae0f3e1283..97e99c3d34f 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/PassthroughInboundDocQueryTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/PassthroughInboundDocQueryTest.java @@ -27,6 +27,7 @@ package gov.hhs.fha.nhinc.docquery.inbound; import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; +import java.util.Properties; import org.junit.Test; /** @@ -50,8 +51,9 @@ public void passthroughInboundDocQueryHomeHcid() { private void passthroughInboundDocQueryHomeHcid(String sendingHcid, String sendingHcidFormatted) { AssertionType mockAssertion = getMockAssertion(sendingHcid); + PassthroughInboundDocQuery passthroughDocQuery = new PassthroughInboundDocQuery( - getMockAdapterFactory(mockAssertion), getAuditLogger(true)); + getMockAdapterFactory(mockAssertion, new Properties()), getAuditLogger(true)); verifyInboundDocQuery(mockAssertion, sendingHcidFormatted, passthroughDocQuery, NUM_TIMES_TO_INVOKE_ADAPTER_AUDIT); diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/StandardInboundDocQueryTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/StandardInboundDocQueryTest.java index de055e22903..5763ad52f46 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/StandardInboundDocQueryTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/inbound/StandardInboundDocQueryTest.java @@ -72,7 +72,7 @@ private void standardInboundDocQueryHomeHcid(String sendingHcid, String sendingH AssertionType mockAssertion = getMockAssertion(sendingHcid); StandardInboundDocQuery standardDocQuery = new StandardInboundDocQuery(policyChecker, - getMockAdapterFactory(mockAssertion), getAuditLogger(true)) { + getMockAdapterFactory(mockAssertion, new Properties()), getAuditLogger(true)) { @Override protected String getLocalHomeCommunityId() { return RESPONDING_HCID_FORMATTED; diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpImplTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpImplTest.java index e3fe4c7f78d..f51d81f58a6 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpImplTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpImplTest.java @@ -35,7 +35,7 @@ public class NhinDocQueryProxyNoOpImplTest { @Test public void responseHasObjectTypeList() throws Exception { NhinDocQueryProxyNoOpImpl impl = new NhinDocQueryProxyNoOpImpl(); - AdhocQueryResponse response = impl.respondingGatewayCrossGatewayQuery(null, null, null); + AdhocQueryResponse response = impl.respondingGatewayCrossGatewayQuery(null, null, null, null); AdhocQueryResponseAsserter.assertSchemaCompliant(response); } } diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpTest.java index 06e6fac8014..ba4225d16b5 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryProxyNoOpTest.java @@ -32,6 +32,7 @@ import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryRequestDescriptionBuilder; import gov.hhs.fha.nhinc.docquery.aspect.AdhocQueryResponseDescriptionBuilder; import java.lang.reflect.Method; +import java.util.List; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -43,7 +44,7 @@ public class NhinDocQueryProxyNoOpTest { public void hasBeginOutboundProcessingEvent() throws Exception { Class clazz = NhinDocQueryProxyNoOpImpl.class; Method method = clazz.getMethod("respondingGatewayCrossGatewayQuery", AdhocQueryRequest.class, - AssertionType.class, NhinTargetSystemType.class); + AssertionType.class, NhinTargetSystemType.class, List.class); NwhinInvocationEvent annotation = method.getAnnotation(NwhinInvocationEvent.class); assertNotNull(annotation); assertEquals(AdhocQueryRequestDescriptionBuilder.class, annotation.beforeBuilder()); diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryWebServiceProxyTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryWebServiceProxyTest.java index 9e001bba395..32e5607c533 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryWebServiceProxyTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/nhin/proxy/NhinDocQueryWebServiceProxyTest.java @@ -38,8 +38,11 @@ import gov.hhs.fha.nhinc.nhinclib.NhincConstants.UDDI_SPEC_VERSION; import ihe.iti.xds_b._2007.RespondingGatewayQueryPortType; import java.lang.reflect.Method; +import java.util.List; +import java.util.ArrayList; import javax.xml.ws.Service; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; +import org.apache.cxf.headers.Header; import org.jmock.Mockery; import org.jmock.integration.junit4.JMock; import org.jmock.integration.junit4.JUnit4Mockery; @@ -68,6 +71,7 @@ public class NhinDocQueryWebServiceProxyTest { final Service mockService = context.mock(Service.class); final RespondingGatewayQueryPortType mockPort = context.mock(RespondingGatewayQueryPortType.class); + final List
headers = new ArrayList<>(); @SuppressWarnings("unchecked") private CONNECTClient client = mock(CONNECTClient.class); @@ -79,7 +83,7 @@ public class NhinDocQueryWebServiceProxyTest { public void hasBeginOutboundProcessingEvent() throws Exception { Class clazz = NhinDocQueryProxyWebServiceSecuredImpl.class; Method method = clazz.getMethod("respondingGatewayCrossGatewayQuery", AdhocQueryRequest.class, - AssertionType.class, NhinTargetSystemType.class); + AssertionType.class, NhinTargetSystemType.class, List.class); NwhinInvocationEvent annotation = method.getAnnotation(NwhinInvocationEvent.class); assertNotNull(annotation); assertEquals(AdhocQueryRequestDescriptionBuilder.class, annotation.beforeBuilder()); @@ -92,7 +96,7 @@ public void hasBeginOutboundProcessingEvent() throws Exception { public void testNoMtom() throws Exception { NhinDocQueryProxyWebServiceSecuredImpl impl = getImpl(); NhinTargetSystemType target = getTarget("1.1"); - impl.respondingGatewayCrossGatewayQuery(request, assertion, target); + impl.respondingGatewayCrossGatewayQuery(request, assertion, target, headers); verify(client, never()).enableMtom(); } @@ -100,7 +104,7 @@ public void testNoMtom() throws Exception { public void testUsingGuidance() throws Exception { NhinDocQueryProxyWebServiceSecuredImpl impl = getImpl(); NhinTargetSystemType target = getTarget("1.1"); - impl.respondingGatewayCrossGatewayQuery(request, assertion, target); + impl.respondingGatewayCrossGatewayQuery(request, assertion, target, headers); verify(cache).getEndpointURL(any(String.class), any(String.class), any(UDDI_SPEC_VERSION.class)); } @@ -146,6 +150,11 @@ public CONNECTClient getCONNECTClientSecured( protected ExchangeManager getCMInstance() { return cache; } + + @Override + protected void addResponseHeaders(List
responseHeaders, Object port) { + //do nothing + } }; } } diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/PassthroughOutboundDocQueryTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/PassthroughOutboundDocQueryTest.java index 63ca4a1bef8..8398c26c958 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/PassthroughOutboundDocQueryTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/PassthroughOutboundDocQueryTest.java @@ -37,9 +37,12 @@ import gov.hhs.fha.nhinc.docquery.entity.OutboundDocQueryDelegate; import gov.hhs.fha.nhinc.docquery.entity.OutboundDocQueryOrchestratable; import gov.hhs.fha.nhinc.nhinclib.NhincConstants; +import java.util.List; import java.util.Properties; +import javax.xml.ws.WebServiceContext; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; +import org.apache.cxf.headers.Header; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; @@ -61,6 +64,7 @@ public class PassthroughOutboundDocQueryTest { private final AuditEJBLogger mockEJBLogger = mock(AuditEJBLogger.class); + private final WebServiceContext context = mock(WebServiceContext.class); @Test public void passthroughOutboundDocQuery() { @@ -81,9 +85,14 @@ public void passthroughOutboundDocQuery() { protected DocQueryAuditLogger getAuditLogger() { return auditLogger; } + + @Override + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders){ + //do nothing + } }; AdhocQueryResponse actualResponse = passthroughDocQuery.respondingGatewayCrossGatewayQuery(request, assertion, - targets); + targets, context); assertSame(expectedResponse, actualResponse); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); @@ -139,10 +148,15 @@ protected void logWarning(String warning) { protected DocQueryAuditLogger getAuditLogger() { return auditLogger; } + + @Override + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders){ + //do nothing + } }; AdhocQueryResponse actualResponse = passthroughDocQuery.respondingGatewayCrossGatewayQuery(request, assertion, - targets); + targets, context); verify(mockLogger).warn(logMessageCaptor.capture()); assertSame(expectedResponse, actualResponse); @@ -173,9 +187,13 @@ public void auditLoggingOffForOutboundDQ() { protected DocQueryAuditLogger getAuditLogger() { return auditLogger; } + @Override + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders){ + //do nothing + } }; AdhocQueryResponse actualResponse = passthroughDocQuery.respondingGatewayCrossGatewayQuery(request, assertion, - targets); + targets, context); assertSame(expectedResponse, actualResponse); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); diff --git a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/StandardOutboundDocQueryTest.java b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/StandardOutboundDocQueryTest.java index c2a28191d24..63af7c150f7 100644 --- a/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/StandardOutboundDocQueryTest.java +++ b/Product/Production/Services/DocumentQueryCore/src/test/java/gov/hhs/fha/nhinc/docquery/outbound/StandardOutboundDocQueryTest.java @@ -50,11 +50,13 @@ import java.util.Arrays; import java.util.List; import java.util.Properties; +import javax.xml.ws.WebServiceContext; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest; import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse; import oasis.names.tc.ebxml_regrep.xsd.rim._3.AdhocQueryType; import oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1; import oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType; +import org.apache.cxf.headers.Header; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; @@ -76,6 +78,7 @@ public class StandardOutboundDocQueryTest { private final DocQueryPolicyChecker policyChecker = mock(DocQueryPolicyChecker.class); private final AggregationStrategy strategy = mock(AggregationStrategy.class); private final AggregationService service = mock(AggregationService.class); + private final WebServiceContext context = mock(WebServiceContext.class); private static final String HOME_HCID = "1.0"; private static final String SENDING_HCID_FORMATTED = "1.2"; @@ -85,7 +88,7 @@ public void testrespondingGatewayCrossGatewayQueryforNullEndPoint() throws Excep NhinTargetSystemType target = null; final DocQueryAuditLogger auditLogger = getAuditLogger(true); AssertionType assertion = new AssertionType(); - + StandardOutboundDocQuery entitydocqueryimpl = new StandardOutboundDocQuery(strategy, service, policyChecker) { @Override protected DocQueryAuditLogger getAuditLogger() { @@ -96,11 +99,16 @@ protected DocQueryAuditLogger getAuditLogger() { protected String getSenderHcid() { return SENDING_HCID_FORMATTED; } + + @Override + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders) { + //do nothing + } }; NhinTargetCommunitiesType targets = createNhinTargetCommunites(); AdhocQueryResponse response = entitydocqueryimpl.respondingGatewayCrossGatewayQuery(adhocQueryRequest, - assertion, targets); + assertion, targets, context); verify(service).createChildRequests(eq(adhocQueryRequest), eq(assertion), eq(targets)); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger, never()).auditRequestMessage(eq(adhocQueryRequest), eq(assertion), eq(target), @@ -124,13 +132,18 @@ protected DocQueryAuditLogger getAuditLogger() { protected String getSenderHcid() { return SENDING_HCID_FORMATTED; } + + @Override + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders) { + //do nothing + } }; AdhocQueryRequest adhocQueryRequest = mock(AdhocQueryRequest.class); AssertionType assertion = mock(AssertionType.class); NhinTargetCommunitiesType targets = mock(NhinTargetCommunitiesType.class); AdhocQueryResponse response = docQuery - .respondingGatewayCrossGatewayQuery(adhocQueryRequest, assertion, targets); + .respondingGatewayCrossGatewayQuery(adhocQueryRequest, assertion, targets, context); AdhocQueryResponseAsserter.assertSchemaCompliant(response); verify(mockEJBLogger, never()).auditRequestMessage(eq(adhocQueryRequest), eq(assertion), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), @@ -195,7 +208,7 @@ private NhinTargetCommunitiesType createNhinTargetCommunites() { public void hasBeginOutboundProcessingEvent() throws Exception { Class clazz = StandardOutboundDocQuery.class; Method method = clazz.getMethod("respondingGatewayCrossGatewayQuery", AdhocQueryRequest.class, - AssertionType.class, NhinTargetCommunitiesType.class); + AssertionType.class, NhinTargetCommunitiesType.class, WebServiceContext.class); OutboundProcessingEvent annotation = method.getAnnotation(OutboundProcessingEvent.class); assertNotNull(annotation); assertEquals(AdhocQueryRequestDescriptionBuilder.class, annotation.beforeBuilder()); @@ -226,6 +239,11 @@ protected DocQueryAuditLogger getAuditLogger() { protected String getSenderHcid() { return SENDING_HCID_FORMATTED; } + + @Override + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders) { + //do nothing + } }; NhinTargetCommunitiesType targets = createNhinTargetCommunites(); @@ -236,7 +254,7 @@ protected String getSenderHcid() { when(policyChecker.checkOutgoingPolicy(any(AdhocQueryRequest.class), any(AssertionType.class))).thenReturn(false); AdhocQueryResponse response = entitydocqueryimpl.respondingGatewayCrossGatewayQuery(adhocQueryRequest, - assertion, targets); + assertion, targets, context); verify(service).createChildRequests(eq(adhocQueryRequest), eq(assertion), eq(targets)); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger, never()).auditRequestMessage(eq(adhocQueryRequest), eq(assertion), eq(target), @@ -268,6 +286,11 @@ protected DocQueryAuditLogger getAuditLogger() { protected String getSenderHcid() { return SENDING_HCID_FORMATTED; } + + @Override + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders) { + //do nothing + } }; when(policyChecker.checkOutgoingPolicy(any(AdhocQueryRequest.class), any(AssertionType.class))).thenReturn(false) @@ -281,7 +304,7 @@ protected String getSenderHcid() { NhinTargetCommunitiesType targets = createNhinTargetCommunites(); when(service.createChildRequests(eq(adhocQueryRequest), eq(assertion), eq(targets))).thenReturn(list); - entitydocqueryimpl.respondingGatewayCrossGatewayQuery(adhocQueryRequest, assertion, targets); + entitydocqueryimpl.respondingGatewayCrossGatewayQuery(adhocQueryRequest, assertion, targets, context); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger, atLeast(1)).auditRequestMessage(eq(adhocQueryRequest), eq(assertion), eq(target), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), @@ -311,6 +334,11 @@ protected DocQueryAuditLogger getAuditLogger() { protected String getSenderHcid() { return SENDING_HCID_FORMATTED; } + + @Override + protected void addResponseHeadersToContext(WebServiceContext context, List
responseHeaders) { + //do nothing + } }; when(policyChecker.checkOutgoingPolicy(any(AdhocQueryRequest.class), any(AssertionType.class))).thenReturn(false) @@ -321,7 +349,7 @@ protected String getSenderHcid() { NhinTargetCommunitiesType targets = createNhinTargetCommunites(); when(service.createChildRequests(eq(adhocQueryRequest), eq(assertion), eq(targets))).thenReturn(list); - entitydocqueryimpl.respondingGatewayCrossGatewayQuery(adhocQueryRequest, assertion, targets); + entitydocqueryimpl.respondingGatewayCrossGatewayQuery(adhocQueryRequest, assertion, targets, context); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger, never()).auditRequestMessage(eq(adhocQueryRequest), eq(assertion), eq(target), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE),