Author: hiranya
Date: Wed Jul 30 03:45:01 2008
New Revision: 680969
URL: http://svn.apache.org/viewvc?rev=680969&view=rev
Log:
Added a new sample (sample 259) to the documentation.
The new sample demonstrates switching from FIX to HTTP. (see SYNAPSE-401)
Patch provided by Asanka A.
Two new files added under the repository/conf/sample directory and the
Synapse_Samples.xml file modified suitably.
Added:
synapse/trunk/java/repository/conf/sample/resources/transform/transform_fix_to_http.xslt
synapse/trunk/java/repository/conf/sample/synapse_sample_259.xml
Modified:
synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml
Added:
synapse/trunk/java/repository/conf/sample/resources/transform/transform_fix_to_http.xslt
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/resources/transform/transform_fix_to_http.xslt?rev=680969&view=auto
==============================================================================
---
synapse/trunk/java/repository/conf/sample/resources/transform/transform_fix_to_http.xslt
(added)
+++
synapse/trunk/java/repository/conf/sample/resources/transform/transform_fix_to_http.xslt
Wed Jul 30 03:45:01 2008
@@ -0,0 +1,34 @@
+<?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.
+ -->
+<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/[EMAIL PROTECTED]'44']"/></m0:price>
+ <m0:quantity><xsl:value-of
select="//message/body/[EMAIL PROTECTED]'38']"/></m0:quantity>
+ <m0:symbol><xsl:value-of
select="//message/body/[EMAIL PROTECTED]'55']"/></m0:symbol>
+ </m0:order>
+ </m0:placeOrder>
+ </xsl:template>
+</xsl:stylesheet>
+
Added: synapse/trunk/java/repository/conf/sample/synapse_sample_259.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_259.xml?rev=680969&view=auto
==============================================================================
--- synapse/trunk/java/repository/conf/sample/synapse_sample_259.xml (added)
+++ synapse/trunk/java/repository/conf/sample/synapse_sample_259.xml Wed Jul 30
03:45:01 2008
@@ -0,0 +1,42 @@
+<!--
+ ~ 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.
+ -->
+
+<!-- FIX to HTTP Proxy Service -->
+<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>
+
Modified: synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml?rev=680969&r1=680968&r2=680969&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml (original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml Wed Jul 30 03:45:01
2008
@@ -310,14 +310,18 @@
<a href="#Sample256">Sample 256: Proxy services with the mail
transport</a>
</li>
- <li>
+ <li>
<a href="#Sample257">Sample 257: Proxy services with the FIX
transport</a>
</li>
- <li>
+ <li>
<a href="#Sample258">Sample 258: Switching from HTTP to FIX
</a>
</li>
+ <li>
+ <a href="#Sample259">Sample 259: Switching from FIX to HTTP
+ </a>
+ </li>
</ul>
</li>
<li>
@@ -3849,6 +3853,97 @@
generally sends two responses for each incoming order request. But since
the
response has to be forwarded over HTTP only one can be sent back to the
client.
</p>
+ <h2>
+ <a name="Sample259" id="Sample259">Sample 259: Switch from FIX to
HTTP </a>
+ </h2>
+ <pre xml:space="preserve">
+ <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>
+ </pre>
+ <p>
+ <strong>Objective: Demonstrate the capability of switching between
FIX to HTTP</strong>
+ </p>
+ <p>
+ <strong>Prerequisites:</strong><br/>
+ You will need the sample FIX blotter that come with Quickfix/J
+ (Banzai). Configure the blotter to establish
+ sessions with Synapse. See <a
href="Synapse_Samples_Setup.html#fixsamplesconfig">
+ Configuring Sample FIX Applications</a>
+ </p>
+ <p>
+ Start the Axis2 server and deploy the SimpleStockQuoteService if not
already deployed
+ </p>
+ <p>
+ Start Banzai
+ </p>
+ <p>
+ Enable FIX transport in the Synapse axis2.xml. See <a
+ href="Synapse_Samples_Setup.html#fixtransport">Setting up FIX
transport
+ </a>
+ </p>
+ <p>
+ Configure Synapse for FIX samples. See <a
href="Synapse_Samples_Setup.html#fixsamples">
+ Configuring Synapse for FIX Samples</a>
+ </p>
+ <p>
+ Open up the
SYNAPSE_HOME/repository/conf/sample/synapse_sample_259.xml file
+ and make sure that transport.fix.AcceptorConfigURL property points
to the
+ fix-synapse.cfg file you created. Once done you can start the
Synapse configuration numbered 259:
+ i.e. synapse -sample 259. Note that Synapse creates a new FIX
session with
+ Banzai at this point.
+ </p>
+ <p>
+ Send an order request from Banzai to Synapse. e.g. Buy DELL 1000 @
100. User has to send a 'Limit'
+ Order because price is a mandatory field for 'placeOrder' operation.
+ </p>
+ <p>
+ Synapse will forward the order request to one-way 'placeOrder'
operation on the SimpleStockQuoteService. Synapse uses a simple XSLT mediator
to transform the incoming FIX to a SOAP message.
+ </p>
+ <pre xml:space="preserve">
+ <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/[EMAIL PROTECTED]'44']"/></m0:price>
+ <m0:quantity><xsl:value-of
select="//message/body/[EMAIL
PROTECTED]'38']"/></m0:quantity>
+ <m0:symbol><xsl:value-of
select="//message/body/[EMAIL PROTECTED]'55']"/></m0:symbol>
+ </m0:order>
+ </m0:placeOrder>
+ </xsl:template>
+ </xsl:stylesheet>
+ </pre>
+ <p>
+ To get an idea about the various transport parameters being used in
this sample
+ see <a href="Synapse_Samples_Setup.html#fixparameters">FIX Transport
Parameters
+ </a>.
+ </p>
<h1>
<a name="Task" id="Task">Introduction to Synapse Tasks</a>