<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:jaxrs="http://cxf.apache.org/jaxrs"
	xsi:schemaLocation="
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
         http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">

	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
	
	<bean id="samlHandler" class="gov.va.med.cds.ws.saml.handler.SamlAuthorizationHeaderInHandler"/>
	<bean id="samlInInterceptor" class="gov.va.med.cds.ws.saml.interceptor.SAMLTokenInterceptor"/>
	<bean id="cleanupOutInterceptor" class="gov.va.med.cds.ws.saml.interceptor.CleanupOutInterceptor"/>

	<jaxws:endpoint id="cdsService" implementorClass="gov.va.med.cds.ejb.ClinicalDataServiceSynchronousSession" implementor="#cdsStatelessSession"
		address="/cds-service">
		<jaxws:properties>
			<entry key="faultStackTraceEnabled" value="true" />
			<entry key="exceptionMessageCauseEnabled" value="true" />
		</jaxws:properties>
		<jaxws:inInterceptors>
    		<ref bean="samlInInterceptor"/>
 		</jaxws:inInterceptors>
		<jaxws:outInterceptors>
    		<ref bean="cleanupOutInterceptor"/>
 		</jaxws:outInterceptors>
	</jaxws:endpoint>

	<jaxrs:server id="isAliveServiceProxy" address="/cds-service/isAlive">
		<jaxrs:serviceBeans>
			<bean class="gov.va.med.cds.webservice.RestClinicalDataServiceIsAliveProxy">
				<property name="clinicalDataService" ref="cdsStatelessSession" />
			</bean>
		</jaxrs:serviceBeans>
	</jaxrs:server>

	<jaxrs:server id="appendServiceProxy" address="/cds-service/appendClinicalData">
		<jaxrs:serviceBeans>
			<bean class="gov.va.med.cds.webservice.RestClinicalDataServiceAppendProxy">
				<property name="clinicalDataService" ref="cdsStatelessSession" />
			</bean>
		</jaxrs:serviceBeans>
	</jaxrs:server>

	<jaxrs:server id="createServiceProxy" address="/cds-service/createClinicalData">
		<jaxrs:serviceBeans>
			<bean class="gov.va.med.cds.webservice.RestClinicalDataServiceCreateProxy">
				<property name="clinicalDataService" ref="cdsStatelessSession" />
			</bean>
		</jaxrs:serviceBeans>
	</jaxrs:server>

	<jaxrs:server id="deleteServiceProxy" address="/cds-service/deleteClinicalData">
		<jaxrs:serviceBeans>
			<bean class="gov.va.med.cds.webservice.RestClinicalDataServiceDeleteProxy">
				<property name="clinicalDataService" ref="cdsStatelessSession" />
			</bean>
		</jaxrs:serviceBeans>
	</jaxrs:server>

	<jaxrs:server id="readServiceProxy" address="/cds-service/readClinicalData1">
		<jaxrs:serviceBeans>
			<bean class="gov.va.med.cds.webservice.RestClinicalDataServiceReadProxy">
				<property name="clinicalDataService" ref="cdsStatelessSession" />
			</bean>
		</jaxrs:serviceBeans>
		<jaxrs:providers>
      		<ref bean="samlHandler"/>
   		</jaxrs:providers>
   		<jaxrs:outInterceptors>
    		<ref bean="cleanupOutInterceptor"/>
 		</jaxrs:outInterceptors>
	</jaxrs:server>

	<jaxrs:server id="updateServiceProxy" address="/cds-service/updateClinicalData">
		<jaxrs:serviceBeans>
			<bean class="gov.va.med.cds.webservice.RestClinicalDataServiceUpdateProxy">
				<property name="clinicalDataService" ref="cdsStatelessSession" />
			</bean>
		</jaxrs:serviceBeans>
	</jaxrs:server>

	<bean id="cdsStatelessSession" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean" lazy-init="true">
		<property name="lookupHomeOnStartup" value="false" />
		<property name="jndiName">
			<value>comp/env/ejb/local/gov/va/med/cds/ClinicalDataServiceSynchronousSession</value>
		</property>
		<property name="jndiEnvironment">
			<props>
				<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
			</props>
		</property>
		<property name="businessInterface">
			<value>gov.va.med.cds.client.ClinicalDataServiceInterface</value>
		</property>
	</bean>

</beans>
