Source

esbperformance / mule / mule-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:http="http://www.mulesoft.org/schema/mule/http"
      xmlns:jetty="http://www.mulesoft.org/schema/mule/jetty"
      xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
      xmlns:mxml="http://www.mulesoft.org/schema/mule/xml"
      xmlns:sxc="http://www.mulesoft.org/schema/mule/sxc"
      xmlns:spring="http://www.springframework.org/schema/beans"
      xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
      xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
      xmlns:ss="http://www.springframework.org/schema/security"
      xsi:schemaLocation="
       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd
       http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.3/mule-http.xsd
       http://www.mulesoft.org/schema/mule/jetty http://www.mulesoft.org/schema/mule/jetty/3.3/mule-jetty.xsd
       http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.3/mule-xml.xsd
       http://www.mulesoft.org/schema/mule/sxc http://www.mulesoft.org/schema/mule/sxc/3.3/mule-sxc.xsd
       http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/current/mule-pattern.xsd
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.3/mule-cxf.xsd
       http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.3/mule-spring-security.xsd
       http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd">

    <configuration>
        <default-dispatcher-threading-profile
                maxThreadsActive="300"
                maxThreadsIdle="100"
                poolExhaustedAction="WAIT"/>
    </configuration>

    <jetty:connector name="JettyConnector" configFile="file:conf/jetty.xml"/>
    <http:connector name="HttpConnector" keepAlive="true" sendTcpNoDelay="true"/>

    <mxml:xslt-transformer name="Xsltin" xsl-file="conf/transform_env_reverse.xslt" returnClass="org.mule.module.xml.transformer.DelayedResult"/>
    <mxml:xslt-transformer name="Xsltout" xsl-file="conf/transform_env.xslt" returnClass="org.mule.module.xml.transformer.DelayedResult"/>

    <custom-transformer name="XmlToOutputHandler" class="org.mule.module.xml.transformer.XmlToOutputHandler"/>

    <spring:beans>
        <spring:bean name="WSProxyService" class="org.mule.module.cxf.WSProxyService">
            <spring:property name="wsdlFile" value="conf/ProxyWSDL-embedded.wsdl"/>
        </spring:bean>

        <spring:bean name="wss4jInConfiguration" class="org.springframework.beans.factory.config.MapFactoryBean">
            <spring:property name="sourceMap">
                <spring:map>
                    <spring:entry key="action" value="Timestamp Encrypt Signature"/>
                    <spring:entry key="signaturePropFile" value="wssecurity.properties"/>
                    <spring:entry key="decryptionPropFile" value="wssecurity.properties"/>
                    <spring:entry key="passwordCallbackClass" value="org.mule.module.cxf.wssec.ServerPasswordCallback"/>
                    <spring:entry key="timeToLive" value="2147483"/>
                </spring:map>
            </spring:property>
        </spring:bean>

        <spring:bean name="wss4jOutConfiguration" class="org.springframework.beans.factory.config.MapFactoryBean">
            <spring:property name="sourceMap">
                <spring:map>
                    <spring:entry key="action" value="Timestamp Signature Encrypt"/>
                    <spring:entry key="user" value="bob"/>
                    <spring:entry key="signaturePropFile" value="wssecurity.properties"/>
                    <spring:entry key="encryptionPropFile" value="wssecurity.properties"/>
                    <spring:entry key="encryptionUser" value="Alice"/>
                    <spring:entry key="signatureKeyIdentifier" value="DirectReference"/>
                    <spring:entry key="passwordCallbackClass" value="org.mule.module.cxf.wssec.ServerPasswordCallback"/>
                    <spring:entry key="signatureParts"
                                  value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body"/>
                    <spring:entry key="encryptionParts"
                                  value="{Element}{http://www.w3.org/2000/09/xmldsig#}Signature;{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body"/>
                    <!--<entry key="encryptionKeyTransportAlgorithm" value="rsa-1_5"/>-->
                    <spring:entry key="encryptionSymAlgorithm" value="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
                </spring:map>
            </spring:property>
        </spring:bean>

        <mule-ss:security-manager>
            <mule-ss:delegate-security-provider name="memory-dao" delegate-ref="authenticationManager"/>
        </mule-ss:security-manager>

        <ss:authentication-manager alias="authenticationManager"/>

        <ss:authentication-provider>
            <ss:user-service id="userService">
                <ss:user name="alice" password="password" authorities="ROLE_ADMIN"/>
                <ss:user name="bob" password="password" authorities="ROLE_ANON"/>
            </ss:user-service>
        </ss:authentication-provider>
    </spring:beans>

    <endpoint name="RemoteEndpoint"
        connector-ref="HttpConnector"
        address="http://localhost:9000/service/EchoService"
        exchange-pattern="request-response">
        <!--message-properties-transformer scope="outbound">
            <add-message-property key="SOAPAction" value="#[header:INBOUND:SOAPAction]"/>
            <add-message-property key="Content-Type" value="#[header:INBOUND:Content-Type]"/>
        </message-properties-transformer-->
    </endpoint>

    <pattern:web-service-proxy name="DirectProxy"
        inboundAddress="jetty:http://0.0.0.0:8090/service/DirectProxy"
        outboundEndpoint-ref="RemoteEndpoint" 
        wsdlFile="conf/ProxyWSDL-embedded.wsdl" />

    <flow name="XSLTProxy">
        <inbound-endpoint
                connector-ref="JettyConnector" 
                address="jetty:http://0.0.0.0:8090/service/XSLTProxy"
                transformer-refs="Xsltin XmlToOutputHandler" 
                responseTransformer-refs="Xsltout XmlToOutputHandler" 
                exchange-pattern="request-response"/>
        <outbound-endpoint connector-ref="HttpConnector"
                                   address="http://localhost:9000/service/EchoService"
                                   exchange-pattern="request-response">
            <message-properties-transformer scope="outbound">
                <add-message-property key="SOAPAction" value="#[header:INBOUND:SOAPAction]"/>
                <add-message-property key="Content-Type" value="#[header:INBOUND:Content-Type]"/>
            </message-properties-transformer>
        </outbound-endpoint>
    </flow>   

    <model name="PerfModel">

        <service name="CBRProxy">
            <inbound>
                <inbound-endpoint connector-ref="JettyConnector" 
                    address="jetty:http://0.0.0.0:8090/service/CBRProxy"
                    exchange-pattern="request-response"/>
            </inbound>
            <outbound>
                <!--
                <custom-forwarding-catch-all-strategy class="org.mule.routing.ForwardingCatchAllStrategy">
                    <outbound-endpoint ref="ErrorEndpoint"/>
                </custom-forwarding-catch-all-strategy>
                -->
                <sxc:filtering-router>
                    <outbound-endpoint ref="RemoteEndpoint" transformer-refs="XmlToOutputHandler">
                        <message-properties-transformer scope="outbound">
                            <add-message-property key="SOAPAction" value="#[header:INBOUND:SOAPAction]"/>
                            <add-message-property key="Content-Type" value="#[header:INBOUND:Content-Type]"/>
                        </message-properties-transformer>                  
                    </outbound-endpoint>
                    <sxc:filter pattern="//order[1]/symbol[text()='IBM']"/>
                </sxc:filtering-router>
            </outbound>
        </service>

        <service name="CBRSOAPHeaderProxy">
            <inbound>
                <jetty:inbound-endpoint address="http://0.0.0.0:8090/service/CBRSOAPHeaderProxy"
                                        exchange-pattern="request-response"/>
            </inbound>
            <component>
                <spring-object bean="WSProxyService"/>
            </component>
            <outbound>
                <filtering-router>
                    <outbound-endpoint ref="RemoteEndpoint" transformer-refs="XmlToOutputHandler">
                    <message-properties-transformer scope="outbound">
                            <add-message-property key="SOAPAction" value="#[header:INBOUND:SOAPAction]"/>
                            <add-message-property key="Content-Type" value="#[header:INBOUND:Content-Type]"/>
                        </message-properties-transformer>                  
                    </outbound-endpoint>
                    <mxml:xpath-filter pattern="//ns1:routing" expectedValue="xadmin;server1;community#1.0##">
                        <mxml:namespace prefix="ns1" uri="http://someuri"/>
                    </mxml:xpath-filter>
                </filtering-router>
            </outbound>
        </service>

        <service name="CBRTransportHeaderProxy">
            <inbound>
                <jetty:inbound-endpoint address="http://0.0.0.0:8090/service/CBRTransportHeaderProxy"
                                        exchange-pattern="request-response"/>
            </inbound>
            <component>
                <spring-object bean="WSProxyService"/>
            </component>
            <outbound>
                <filtering-router>
                    <outbound-endpoint ref="RemoteEndpoint" transformer-refs="XmlToOutputHandler">
                    <message-properties-transformer scope="outbound">
                            <add-message-property key="SOAPAction" value="#[header:INBOUND:SOAPAction]"/>
                            <add-message-property key="Content-Type" value="#[header:INBOUND:Content-Type]"/>
                        </message-properties-transformer>                  
                    </outbound-endpoint>
                    <expression-filter evaluator="header" expression="inbound:routing=xadmin;server1;community#1.0##"/>
                </filtering-router>
            </outbound>
        </service>

        <service name="SecureProxy">
            <inbound>
                <jetty:inbound-endpoint address="http://0.0.0.0:8090/service/SecureProxy"
                                        exchange-pattern="request-response">
                    <cxf:proxy-service payload="body" service="SecureProxy"
                                       wsdlLocation="conf/ProxyWSDL-embedded-secure.wsdl"
                                       namespace="http://services.samples/xsd">
                        <cxf:inInterceptors>
                            <spring:bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
                                <spring:property name="properties" ref="wss4jInConfiguration"/>
                            </spring:bean>
                        </cxf:inInterceptors>
                        <cxf:outInterceptors>
                            <spring:bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
                                <spring:property name="properties" ref="wss4jOutConfiguration"/>
                            </spring:bean>
                        </cxf:outInterceptors>
                    </cxf:proxy-service>
                </jetty:inbound-endpoint>
            </inbound>
            <outbound>
                <pass-through-router>
                    <outbound-endpoint ref="RemoteEndpoint" exchange-pattern="request-response"
                                       transformer-refs="XmlToOutputHandler">
                        <cxf:proxy-client payload="body"/>
                        <message-properties-transformer scope="outbound">
                            <add-message-property key="SOAPAction" value="#[header:INBOUND:SOAPAction]"/>
                            <add-message-property key="Content-Type" value="#[header:INBOUND:Content-Type]"/>
                        </message-properties-transformer>                  
                    </outbound-endpoint>
                </pass-through-router>
            </outbound>
        </service>

    </model>

</mule>