<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.0"
       xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.0"
       xmlns:http="http://www.mulesource.org/schema/mule/http/2.0"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
       http://www.mulesource.org/schema/mule/vm/2.0 http://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd
       http://www.mulesource.org/schema/mule/xml/2.0 http://www.mulesource.org/schema/mule/xml/2.0/mule-xml.xsd
       http://www.mulesource.org/schema/mule/http/2.0 http://www.mulesource.org/schema/mule/http/2.0/mule-http.xsd">

    <http:endpoint name="httpEndpoint" address="http://localhost:18080/RemoteService"
                   synchronous="true" contentType="text/plain"/>
    <endpoint name="httpEndpoint2" address="http://localhost:18081/RemoteService?method=post" synchronous="true"/>
    <endpoint name="vmEndpoint" address="vm://LocalService" synchronous="true"/>

    <byte-array-to-string-transformer name="ByteArrayToString"/>
    <byte-array-to-serializable-transformer name="ByteArrayToSerializable"/>
    <serializable-to-byte-array-transformer name="SerializableToByteArray"/>
    <xm:object-to-xml-transformer name="ObjectToXml"/>
    <gzip-compress-transformer name="Compress"/>
    <http:message-to-http-response-transformer name="ToHttpResponse"/>

    <model name="model">
        <service name="HttpService">
            <inbound>
                <inbound-endpoint ref="httpEndpoint">
                    <transformers>
                        <transformer ref="ByteArrayToString"/>
                    </transformers>
                    <response-transformers>
                        <transformer ref="ObjectToXml"/>
                        <transformer ref="Compress"/>
                        <transformer ref="ToHttpResponse"/>
                    </response-transformers>
                </inbound-endpoint>
            </inbound>
            <echo-component/>
        </service>

        <service name="HttpService2">
            <inbound>
                <inbound-endpoint ref="httpEndpoint2" transformer-refs="ByteArrayToSerializable"
                          responseTransformer-refs="SerializableToByteArray ToHttpResponse"/>
            </inbound>
            <echo-component/>
        </service>

        <service name="LocalService">
            <inbound>
                <inbound-endpoint ref="vmEndpoint"/>
            </inbound>
            <outbound>
                <outbound-pass-through-router>
                    <outbound-endpoint ref="httpEndpoint2" transformer-refs="SerializableToByteArray"/>
                </outbound-pass-through-router>
            </outbound>
        </service>
    </model>
</mule>
