## Apache Synapse

## Sample 259: Switch from FIX to HTTP

<definitions xmlns="http://ws.apache.org/ns/synapse"> <localEntry key="xslt-key-req" src="file:repository/conf/sample/resources/transform/transform_fix_to_http.xslt"/> <proxy name="FIXProxy" transports="fix"> <target> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> <inSequence> <log level="full"/> <xslt key="xslt-key-req"/> <log level="full"/> </inSequence> <outSequence> <log level="full"/> </outSequence> </target> <parameter name="transport.fix.AcceptorConfigURL"> file:repository/conf/sample/resources/fix/fix-synapse.cfg </parameter> <parameter name="transport.fix.AcceptorMessageStore">file</parameter> </proxy> </definitions>

### Objective

In sample 258 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.

### Pre-requisites

- You need a Quickfix/J installation to try out FIX samples. Please download and extract a Quickfix/J distribution into your local machine.
- Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
- Enable the FIX transport receiver for Synapse (refer FIX setup guide for details)
- Start Synapse using the configuration numbered 259 (repository/conf/sample/synapse_sample_259.xml)
  Unix/Linux: sh synapse.sh -sample 259
  Windows: synapse.bat -sample 259
- Configure Banzai sample FIX application (shipped with Quickfix/J) to send messages to Synapse and start it (refer FIX setup guide 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.

### Executing the Client

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.

Accepted order for : 18406 stocks of MSFT at $ 83.58806051152119

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.

Back to Catalog