Switch from FIX to HTTP¶
This example demonstrates how WSO2 Micro Integrator receives messages through FIX and forwards them through HTTP.
The Micro Integrator will forward the order request to a one-way placeOrder
operation in the back-end service. Micro Integrator uses a simple XSLT Mediator to transform the incoming FIX to a SOAP message.
Synapse configuration¶
Following are the integration artifacts that we can used to implement this scenario. See the instructions on how to build and run this example.
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="FIXToHTTPProxy" startOnLoad="true" transports="fix" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="full"/>
<xslt key="{reg_path}/FIX_XSLT.xslt"/>
<log level="full"/>
<header name="Action" value="urn:placeOrder"/>
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService">
</address>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
</outSequence>
<faultSequence/>
</target>
<parameter name="transport.fix.AcceptorConfigURL">file:/{file_path}/fix-synapse.cfg</parameter>
<parameter name="transport.fix.AcceptorMessageStore">file</parameter>
</proxy>
FIX_XSLT:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<m0:placeOrder xmlns:m0="http://services.samples">
<m0:order>
<m0:price>
<xsl:value-of select="//message/body/field[@id='44']"/>
</m0:price>
<m0:quantity>
<xsl:value-of select="//message/body/field[@id='38']"/>
</m0:quantity>
<m0:symbol>
<xsl:value-of select="//message/body/field[@id='55']"/>
</m0:symbol>
</m0:order>
</m0:placeOrder>
</xsl:template>
</xsl:stylesheet>
Build and Run¶
Create the artifacts:
- Set up WSO2 Integration Studio.
- Create an ESB Solution project.
- Add the above XSLT as a registry resource.
- Create the proxy service with the configurations given above.
- Download the FIX transport resources from here and change the
{file_path}
of the proxy with the downloaded location. - Change the
{reg_path}
with the XSLT registry location. - Deploy the artifacts in your Micro Integrator.
Enable the FIX transport and start the Micro-Integrator.
Set up the back-end service:
- Download the stockquote_service.jar
-
Open a terminal, navigate to the location of the downloaded service, and run it (stock quote service) using the following command:
java -jar stockquote_service.jar
Run the quickfixj Banzai sample application.
java -jar quickfixj-examples-banzai-2.1.1.jar
Send an order request from Banzai to Synapse. For example, Buy DELL 1000 @ 100. User has to send a "Limit" Order because price is a mandatory field for placeOrder operation.
Top