Library Link To Toggle Frames Print Feedback

Example

Example 5.5, “Simple Router Configuration” shows a simple router configuration file.

Example 5.5. Simple Router Configuration

<?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE mule-configuration PUBLIC "-//SymphonySoft //DTD mule-configuration XML V1.0//EN"
      "http://www.symphonysoft.com/dtds/mule/mule-configuration.dtd">
  <mule-configuration id="RouterConfig" version="1.0">
    <description>Fragment of a router configuration file.</description>
    <mule-environment-properties clientMode="true" />
1    <transformers>
      <transformer name="InputStreamToString"
                   className="com.iona.cxf.router.mule.transformers.InputStreamToString" />
      <transformer name="StringToInputStream"
                   className="com.iona.cxf.router.mule.transformers.StringToInputStream" />
    </transformers>
    <model name="Sample">
2      <mule-descriptor name="HTTP-to-JMS"
3                       implementation="org.mule.components.simple.PassThroughComponent">
4        <inbound-router>
5          <endpoint address="wsdl-cxf:res:///wsdl/hello_world.wsdl"
                      synchronous="true"
6                    transformers="InputStreamToString">
            <properties>
7              <property name="service"
                        value="{http://apache.org/hello_world}SOAPService" />
8              <property name="port"
                        value="{http://apache.org/hello_world_soap_http}SoapOverHTTP" />
9              <property name="dataFormat" value="message" />
            </properties>
          </endpoint>
        </inbound-router>
        <outbound-router>
10          <router className="org.mule.routing.outbound.OutboundPassThroughRouter">
             <endpoint address="wsdl-cxf:res:///wsdl/hello_world.wsdl"
                       synchronous="true"
11                     transformers="StringToInputStream">
                <properties>
                  <property name="service"
                            value="{http://apache.org/hello_world}SOAPService" />
                  <property name="port"
                            value="{http://apage.org/hello_world}SOAPOverJMS" />
12                  <property name="dataFormat" value="message" />
                </properties>
              </endpoint>
          </router>
        </outbound-router>
    </mule-descriptor>
  </model>
</mule-configuration>

The configuration sample shown in Example 5.5, “Simple Router Configuration” can be explained as follows:

1

The transformers element defines two transformers that are used in the route. One transformer converts the message data InputStream into a string. The other transformer reverses the process.

2

The mule-descriptor defines a route.

3

The implementation attribute specifies the Java class that implements the route's UMO. In this example, the UMO is a simple pass through.

4

The inbound-router element defines the endpoint that acts as the service provider for the route.

5

The endpoint element specifies how the service provider endpoint is to be set up. The address attribute specifies where the WSDL contract defining the service interface used by the endpoint is located.

6

The transformers attribute specifies that messages received by this endpoint will be passed through the InputStreamToString transformer before it is handed off to the UMO.

7

The service property specifies the QName of the service element that defines the endpoint in the WSDL contract.

8

The port property specifies the QName of the port element that defines the endpoint in the WSDL contract.

9

The dataFormat property specifies that this endpoint uses the message data mode.

10

The router element specifies the class that implements the functionality of the outbound router. In this case the outbound router is a pass through router.

11

The endpoint's transformers attribute specifies that messages passing into this endpoint will pass through the StringToInputStream transformer.

12

The dataFormat property specifies that the endpoint uses the message data mode. The setting for this property must match the setting in the inbound router's endpoint.