Creating a simple SIF Agent in Ruby

by admin on August 23, 2010

We just released an Upgrade to our OpenAgent – a SIF Agent Development Kit written in Ruby.
So lets show you what we can easily do.

Create a text file named agent.yaml – and paste the information below. Make sure toupdate the sourceid and sif_name to your Agents info.


sourceid : Your Agent ID Here
sif_name : Your Agent Name Here
sif_version : 2.0r1
sif_maxbuffersize : 64000
sif_mode : Pull
msg_version : 2.0r1
msg_xmlns : http://www.sifinfo.org/infrastructure/2.x
sif_provideobjects:
sif_subscribeobjects:
- LEAInfo
- SchoolInfo
- StudentPersonal
sif_publishaddobjects:
sif_publishchangeobjects:
sif_publishdeleteobjects:
sif_requestobjects:
- LEAInfo
- SchoolInfo
- StudentPersonal
sif_respondobjects:

Now create a text file named zone.yaml and paste the info below. Make sure you add your ZONE URL.


uri : Your ZONE URL Here
use_ssl : false
verify_ssl : false
verify_mode : OpenSSL::SSL::VERIFY_NONE
puts_msg_before_post : true

So lets code up a School Interoperability Framework Agent which will Register and then Subscribe.
Please note that we are not reviewing the SIF_Ack messages that are being set from the ZIS Server
for these messages.

Create a text file names bot.rb


1. require 'rubygems'
2. require 'openagent'
3.
4. agent = OpenAgent::Agent.new('agent.yaml')
5. zone = OpenAgent::Zone.new('zone.yaml')
6. sif = OpenAgent::SIF.new
7.
8. act = OpenAgent::Activity.new( agent, zone, sif)
9.
10. xml, i = act.create_xml('SIF_Register')
11. response = zone.send_message(xml)
12. puts response.body
13. puts
14. xml, i = act.create_xml('SIF_Provision')
15. response = zone.send_message(xml)
16. puts response.body
17. puts

Now you can create a simple SIF bot which can send and receive SIF Messages. Now why don’t you try and send a SIF_GetMessage or a SIF_Ping.

Have Fun.

{ 0 comments }

While working with a client we found that the TestAccommodation object does not validate within the SIF_Provision message. Check this out for yourself by pointing your browser to http://compliance.sifinfo.org/validate/ and paste this in.


<?xml version="1.0" encoding="UTF-8"?>
<SIF_Message Version="2.3" xmlns="http://www.sifinfo.org/infrastructure/2.x">
<SIF_Provision>
<SIF_Header>
<SIF_MsgId>BD5070007BDF012D83B2001FF3502BAD</SIF_MsgId>
<SIF_Timestamp>2010-07-27T15:04:43</SIF_Timestamp>
<SIF_SourceId>Zone1Provider</SIF_SourceId>
</SIF_Header>
<SIF_ProvideObjects>
<SIF_Object ObjectName="TestAccommodation"/>
</SIF_ProvideObjects>
<SIF_SubscribeObjects/>
<SIF_PublishAddObjects>
<SIF_Object ObjectName="TestAccommodation"/>
</SIF_PublishAddObjects>
<SIF_PublishChangeObjects>
<SIF_Object ObjectName="TestAccommodation"/>
</SIF_PublishChangeObjects>
<SIF_PublishDeleteObjects>
<SIF_Object ObjectName="TestAccommodation"/>
</SIF_PublishDeleteObjects>
<SIF_RequestObjects/>
<SIF_RespondObjects>
<SIF_Object ObjectName="TestAccommodation"/>
</SIF_RespondObjects>
</SIF_Provision>
</SIF_Message>

As of July 27th 2010 this won’t validate. Now try this XML SIF Message:


<?xml version="1.0" encoding="UTF-8"?>
<SIF_Message Version="2.3" xmlns="http://www.sifinfo.org/infrastructure/2.x">
<SIF_Provision>
<SIF_Header>
<SIF_MsgId>23D54AA07BE1012D83B3001FF3502BAD</SIF_MsgId>
<SIF_Timestamp>2010-07-27T15:14:45</SIF_Timestamp>
<SIF_SourceId>Zone1Provider</SIF_SourceId>
</SIF_Header>
<SIF_ProvideObjects>
<SIF_Object ObjectName="TestAccommodation"/>
</SIF_ProvideObjects>
<SIF_SubscribeObjects/>
<SIF_PublishAddObjects/>
<SIF_PublishChangeObjects/>
<SIF_PublishDeleteObjects/>
<SIF_RequestObjects/>
<SIF_RespondObjects/>
</SIF_Provision>
</SIF_Message>

It validates successfully!

This is interesting – We are reporting this to the SIF association immediately. This error is within SIF 2.1, 2.2, 2.3 and 2.4 as far as we can tell. If you are able to provide it you should be able to Publish! With so many objects its hard to imagine that we don’t find more of these… but the SIF Association does a great job.

To fix this you will need to update your XSD SIF_SubscribeObjectNamesType. We have updated the XSD for OpenZIS.

{ Comments on this entry are closed }

Creating the SIF_Register Message

June 15, 2010

Our implementation choice for today will be Ruby. To create this message we can use this cool Ruby SIF message API as well as we should have handy the SIF Spec document to make sure that we are creating messages correctly. A SIF_Register message has five mandatory elements, they are: SIF_Header, SIF_Name, SIF_Version, SIF_MaxBufferSize, SIF_Mode [...]

Read the full article →

What are your thoughts on Authentication?

May 24, 2010

We have found ourselves at a fork in the road and wanted to get some input from the community. OpenZIS currently supports three forms of authentication. No Authentication – Used primarily for testing and development. The agents that send requests to the ZIS are not authenticated. Username and Password – Agents are authenticated using a [...]

Read the full article →

Installation from GitHub

March 4, 2010

These steps are based on a new installation on a Ubuntu Server 9.10 user/password: openzis/openzis pwd => /home/openzis sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential sudo apt-get install git-core git clone git://github.com/cwhiteley/OpenZIS.git cd OpenZIS pwd => /home/openzis/OpenZIS sudo apt-get install mysql-server user/pass root/openzis sudo apt-get install mysql-client sudo apt-get install php5-mysql sudo [...]

Read the full article →

Download OpenZIS from GitHub.

December 4, 2009

Getting OpenZIS from GitHub Ubuntu 9 64 bit Server Version Install Git sudo apt-get install git-core Clone OpenZIS Repositories git clone git://github.com/cwhiteley/OpenZIS.git

Read the full article →

OpenZIS version 2.0 released.

November 27, 2009

Today marks the end of some major design and development work that has been going on behind the senses. Starting today OpenZIS will now be at release version 2.0 and can easily be downloaded via our GitHUB account. Release Notes: 1. PUSH capability. 2. Improvements to message log display. 3. Improved error logging.

Read the full article →