<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
  ~  Licensed to the Apache Software Foundation (ASF) under one
  ~  or more contributor license agreements.  See the NOTICE file
  ~  distributed with this work for additional information
  ~  regarding copyright ownership.  The ASF licenses this file
  ~  to you 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.
  -->

<document>
    <properties>
        <title>Apache Synapse - Sample 259</title>
    </properties>
    <body>
        <section name="Sample 259: Switch from FIX to HTTP">
            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;

    &lt;localEntry key="xslt-key-req"
                src="file:repository/conf/sample/resources/transform/transform_fix_to_http.xslt"/&gt;

    &lt;proxy name="FIXProxy" transports="fix"&gt;
        &lt;target&gt;
            &lt;endpoint&gt;
                &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
            &lt;/endpoint&gt;
            &lt;inSequence&gt;
                &lt;log level="full"/&gt;
                &lt;xslt key="xslt-key-req"/&gt;
                &lt;log level="full"/&gt;
            &lt;/inSequence&gt;
            &lt;outSequence&gt;
                &lt;log level="full"/&gt;
            &lt;/outSequence&gt;
        &lt;/target&gt;
        &lt;parameter name="transport.fix.AcceptorConfigURL"&gt;
            file:repository/conf/sample/resources/fix/fix-synapse.cfg
        &lt;/parameter&gt;
        &lt;parameter name="transport.fix.AcceptorMessageStore"&gt;file&lt;/parameter&gt;
    &lt;/proxy&gt;

&lt;/definitions&gt;</div>
            <subsection name="Objective">
                <p>
                    In <a href="sample258.html">sample 258</a> we looked at how to forward HTTP
                    requests over a FIX session. This sample demonstrates how to send a FIX message
                    to an HTTP endpoint.
                </p>
            </subsection>
            <subsection name="Pre-requisites">
                <p>
                    <ul>
                        <li>
                            You need a <a href="http://www.quickfixj.org">Quickfix/J</a> installation
                            to try out FIX samples. Please download and extract a Quickfix/J distribution
                            into your local machine.
                        </li>
                        <li>
                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
                        </li>
                        <li>
                            Enable the FIX transport receiver for Synapse (refer
                            <a href="setup/fix.html#synapse">FIX setup guide</a> for details)
                        </li>
                        <li>
                            Start Synapse using the configuration numbered 259 (repository/conf/sample/synapse_sample_259.xml)
                            <div class="command">
                                Unix/Linux: sh synapse.sh -sample 259<br/>
                                Windows: synapse.bat -sample 259
                            </div>
                        </li>
                        <li>
                            Configure Banzai sample FIX application (shipped with Quickfix/J) to send
                            messages to Synapse and start it (refer <a href="setup/fix.html#banzai">FIX setup guide</a>
                            for more details). If Banzai was properly configured, it should establish
                            a FIX session with Synapse upon startup. You should see some session logon
                            messages on Synapse console and Banzai console.
                        </li>
                    </ul>
                </p>
            </subsection>
            <subsection name="Executing the Client">
                <p>
                    This sample expects a Limit order from Banzai to be received by Synapse and
                    transformed into a place order request in SOAP format. To try it out send a
                    'Limit' order request from Banzai to Synapse. Synapse will convert it into a
                    place order request and send to the Axis2 server over HTTP. The stock quote
                    service in Axis2 will print the following log when it receives the in-only
                    place order request.
                </p>
                <div class="consoleOutput">Accepted order for : 18406 stocks of MSFT at $ 83.58806051152119</div>
                <p>
                    Note that the request sent from Banzai must be of type 'Limit'. Otherwise the
                    XSLT transformation will not work as expected and Axis2 will receive an invalid
                    request. Also since the place order requests are one-way messages, Banzai is not
                    supposed to receive any response in this case.
                </p>
            </subsection>
        </section>
        <p><a href="../samples.html">Back to Catalog</a></p>        
    </body>
</document>