<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~       http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
       xmlns:kie="http://drools.org/schema/kie-spring"
       xsi:schemaLocation="
       http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
       http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    ">

  <kie:kmodule id="CxfSoapSpringWithoutSession">
    <kie:kbase name="test1" packages="test1">
      <kie:ksession name="ksession1">
        <kie:batch>
          <kie:set-global identifier="list" >
            <bean class="java.util.ArrayList" />
          </kie:set-global>
        </kie:batch>
      </kie:ksession>
      <kie:ksession name="ksession2">
        <kie:batch>
          <kie:set-global identifier="list" >
            <bean class="java.util.ArrayList" />
          </kie:set-global>
        </kie:batch>
      </kie:ksession>
    </kie:kbase>
  </kie:kmodule>

  <bean id="kieSpringPostProcessor" class="org.kie.spring.KModuleBeanFactoryPostProcessor"/>

  <cxf:cxfEndpoint id="soapServer"
             address="http://localhost:58002/soap"
             serviceName="ns:CommandExecutor"
             endpointName="ns:CommandExecutorPort"
          wsdlURL="src/test/resources/org/kie/camel/embedded/camel/component/soap.wsdl"
          xmlns:ns="http://soap.jax.drools.org/" >
    <cxf:properties>
      <entry key="dataFormat" value="MESSAGE"/>
      <entry key="defaultOperationName" value="execute"/>
    </cxf:properties>
  </cxf:cxfEndpoint>
f
  <bean id="kiePolicy" class="org.kie.camel.embedded.component.KiePolicy" />

  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

    <route>
      <from uri="cxf://bean://soapServer"/>
      <policy ref="kiePolicy">
        <unmarshal ref="xstream" />       
        <to uri="kie-local:ksession1" />
        <marshal ref="xstream" />
      </policy>
    </route>

    <route id="x1">
      <from uri="direct://http"/>
      <policy ref="kiePolicy">
        <to uri="cxf://bean://soapServer"/>
      </policy>
    </route>

  </camelContext>

</beans>
