<?xml version="1.0" encoding="UTF-8"?>
<switchyard xmlns="urn:switchyard-config:switchyard:1.0"
    xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
    xmlns:bean="urn:switchyard-component-bean:config:1.0"
    xmlns:camel="urn:switchyard-component-camel:config:1.0"
    xmlns:soap="urn:switchyard-component-soap:config:1.0"
    name="soap-attachment">

  <sca:composite name="soap-attachment" targetNamespace="urn:switchyard-quickstart:soap-attachment:1.0">

    <sca:service name="ImageService" promote="InternalEchoServiceBean/InternalEchoService">
      <sca:interface.wsdl interface="ImageService.wsdl#wsdl.porttype(ImageService)"/>
      <soap:binding.soap>
        <soap:wsdl>ImageService.wsdl</soap:wsdl>
        <soap:contextPath>soap-attachment</soap:contextPath>
        <soap:socketAddr>:${jettyPort}</soap:socketAddr>
      </soap:binding.soap>
    </sca:service>
    <sca:reference name="EchoImageService" multiplicity="0..1" promote="InternalEchoServiceBean/EchoImageService">
      <sca:interface.wsdl interface="ImageService-External.wsdl#wsdl.porttype(ImageService)"/>
      <soap:binding.soap>
        <soap:contextMapper/>
        <soap:wsdl>ImageService-External.wsdl</soap:wsdl>
        <soap:endpointAddress>http://localhost:${jettyPort}/soap-attachment-external/ImageServiceService</soap:endpointAddress>
      </soap:binding.soap>
    </sca:reference>
    <sca:component name="InternalEchoServiceBean">
      <camel:implementation.camel>
        <camel:xml path="META-INF/route.xml"/>
      </camel:implementation.camel>
      <sca:service name="InternalEchoService">
        <interface.esb inputType="java:java.lang.String" outputType="java:java.lang.String"/>
      </sca:service>
      <sca:reference name="EchoImageService">
        <interface.esb inputType="java:java.lang.String" outputType="java:java.lang.String"/>
      </sca:reference>
    </sca:component>

    <sca:service name="ImageServiceExternal" promote="EchoServiceBean/EchoService">
      <sca:interface.wsdl interface="ImageService-External.wsdl#wsdl.porttype(ImageService)"/>
      <soap:binding.soap>
        <soap:contextMapper/>
        <soap:wsdl>ImageService-External.wsdl</soap:wsdl>
        <soap:contextPath>soap-attachment-external</soap:contextPath>
        <soap:socketAddr>:${jettyPort}</soap:socketAddr>
      </soap:binding.soap>
    </sca:service>
    <sca:component name="EchoServiceBean">
      <camel:implementation.camel>
        <camel:xml path="META-INF/filter.xml"/>
      </camel:implementation.camel>
      <sca:service name="EchoService">
        <interface.esb inputType="java:java.lang.String" outputType="java:java.lang.String"/>
      </sca:service>
    </sca:component>
  </sca:composite>
  <domain>
    <properties>
      <property name="jettyPort" value="${org.switchyard.component.http.standalone.port:8080}"/>
    </properties>
  </domain>
</switchyard>
