HOME | FIX GATEWAY  | C# INTERFACE PACKAGE 

FixGateway's support for
FIXML

    FixGateway  (c) 2000-2004 Octatec Ltd
   

With FIX4.3, FIXML became part of the FIX standard. Basicaly, the FixSession layer is unaltered in FIX4.3. The tags for sending XML were already present in FIX4.2, these are XmlDataLen and XmlData and are unchanged in FIX4.3. To send XML you just set these tags and send the message like normal. FIX4.3 defines the XML tags that you can use to build a FIXML message.

Because FixGateway focuses on the session layer of the FIX protocol, it does not need to do very much to support FIXML.

However, there are a couple of things FixGateway does to help you.

The first is, FixString has a method that lets you fil in both tags in one call: FixString::SetXmlPayload(LPCTSTR xmlTest). I.E. You can use your favorite XML DOM Implementation to create the XML, then just pass a string representation of it to this method.

The second is, that if the correct config parameters are set, the gateway will automatically add a FIXML header to to the contents of  XmlData (and adjust XmlDataLen accordingly)
 

The Format of an FIXML message

A FIXML message looks rather like this (embeded in a XmlData tag)…

<FIXML>
  <FIXMLMessage>

    <Header>
    … standard header field …
    </Header>

    <ApplicationMessage>
      <MessageType>
        <tag_name>
        value
        </tag_name>
        …
      </MessageType>
    </ApplicationMessage>

  </FIXMLMessage>
</FIXML>

All this goes in the XmlData tag (with the XmlDataLen set appropriately)

You must build this XML and pass it to the FixString::SetXmlPayload() method

The first thing you will notice is that, unlike normal FixGateway usage, you have to add header fields yourself! Well don’t worry, you don’t, the FixGateway will automatically insert the <Header>…</Header>  section in the outgoing XML, so you shouldn’t add the the header (you can turn this behaviour off if you st the config parameter FIXCML_AddHdr to 0

The 2nd thing to note is that the XML is always enclosed in  <FIXML><FIXMLMessage>… </FIXMLMessage></FIXML>. You do not need to include these tags in your XML either, the FixGateway will automatically add these tags to your outgoing XML.  (you can turn this behaviour off if you set the config parameter FIXCML_AddRoot to 0) So you should just build a FIXML <ApplicationMessage> section and send that, e.g.

You can see that in FIXML, the FixMessageType is an XML tag, and the fields of the message are sub-tags of the MessageType tag. Remember the whole FIXML is embedded in the XmlData tag of the actual FIX message. The type of the FIX message that contains the XML ‘payload’ should be something line “FIXML”

E.G Sending a FIXML news message

This is taken from the C# sample CsFixSrv which sends a news message in FIXML format

          String text = String.Format("NEWS ITEM {0}", m_newsCount );
      FixString fixnews = new FixString();
       //fixnews.AddField(FixConst.FIX_FLD_Text, text);
         //m_fixCli.SendFixMsg(FixConst.FIX_MSG_News, fixnews);

      String xmlNews = FormatXMLnews(text);
      fixnews.SetXmlPayload(xmlNews);
      m_fixCli.SendFixMsg(FixConst.FIX_MSG_FIXML, fixnews);
 

  String FormatXMLnews(String newsMsg)
 {
   XmlNode cnode/*child*/, pnode/*parent*/;

   XmlDocument xml = new XmlDocument();
   pnode = xml;

  //cnode = xml.CreateNode(XmlNodeType.Element, "FIXML", "");
  //pnode = pnode.AppendChild(cnode);
  //cnode = xml.CreateNode(XmlNodeType.Element, "FIXMLMessage", "");
  //pnode = pnode.AppendChild(cnode);
         // THE gateway WILL ADD THESE ELEMENTS if the config
         // parameter:  FIXML_addhdr = 1  is set
         // IT WILL ALSO ADD THE FIXML HEADER

   cnode = xml.CreateNode(XmlNodeType.Element, "ApplicationMessage", "");
   pnode = pnode.AppendChild(cnode);

   cnode = xml.CreateNode(XmlNodeType.Element, "News", "");
   pnode = pnode.AppendChild(cnode);

   cnode = xml.CreateNode(XmlNodeType.Element, "Text", "");
   cnode.InnerText = newsMsg;
   pnode = pnode.AppendChild(cnode);

   Console.WriteLine("SEND FIXML(news)...\r\n{0}", xml.OuterXml);

   return xml.OuterXml;
  }

 

Home | FixGateway | AFI/J | SimpleGrid | SBpayroll | SXAzip  |  InstallScript| DiskUsage/DiskClean | Virtual Desktop Manager | ComBridge  |  ComBridge:Java  |
Download Page  |  Order Page