Search This Blog

Monday, April 3, 2017

IBM intelligent operations center for smart city solutions

 

IBM IOC Part 2

There has been a lot of buzz on the smart city concept by IBM and its IBM IOC product.

This is a continuation of the part 1 which is explained here.

 

So till now we were able to setup the IBM IOC on our eclipse environment and in this section we will setup the REST framework which will be used to interact with various data sources of IBM IOC.

So most of the services inside the intelligent operations center can be controlled by REST framework including the CRUD on data sources which is a key component in IOC and other objects.

So lets get started, download the postman client from google chrome store.

Now open the IBM IOC and login as sysadmin/us3rpa88 to the control center for smart cities.

You will be able to see this in chrome, when you login to the IOC login URL

 

image

Mine is integrated with arcGIS will explain in part 3, but you you will see a black screen with the dashboard controls because you are yet not integrated with arcGIS.

 

Now press F12 on to open developer console for Chrome.

You will see something like this.

image

Click on any of the loaded resources and open the headers window, you should be able to see the propagating IBM-Session-ID as shown above, copy that in notepad.

Now we will use this IBM-Session-ID in our REST requests from postman, if you don’t use this you will get cross site errors some thing like this.

Exception thrown by application class 'com.ibm.ioc.servlet.filter.CSRFFilter.doFilter

I was scratching my head for hours and couldn’t find the reason, there is a programming guide for IOC that says we need to use this(com.ibm.ioc.sessionid) property and assign it the value of the JSESSIONID which is present in the cookies as show above.

I used this programming guide - http://www.redbooks.ibm.com/redbooks/pdfs/sg248201.pdf

Any ways, you can open the postman now and add the URL of your server with Get request and HTTP basic authentication.

Checkout below picture on how to fire the request to REST of IOC.

image

So you only need two parameters to start accessing the REST and nothing else is required.

Now you can navigate to various other REST resources and use the same format.

Some of them are listed in the above mentioned guide on page 27 – Table 1-12.

 

One example which we will commonly use during this series is updating a data source via REST, use case could be you trying to update from other external systems which are Java based or any other systems which supports HTTP Post.

 

I used this to update my data source of id/7 and I used this below URL and headers to add a new event to the data source, in my case its a new bus stop.

The request was.

image

200 success response means, the data item is created in the data source.

 

image

I will tell you another key finding which took some time for me to discover was, the table that was storing my data items while I was posting through REST.

So there will be a custom table created for every data source which is imported in IOC.

For me data source was busstop and the table that got created is shown below.

 

image

 

I used the following JSON as body of the post, please make sure you use Point( Longitude Latitude) else the data –injection service will not create the location object.

com.ibm.db2.jcc.am.oe—check last column of BUSSTOP table, if that location object is created properly then only you will see your data on the map else it will not be visible.(Key take away)

 

My table:

image

 

To view the data items you can use data source service.

image

Fig 1.9

 

Next part of this IBM IOC series we will cover how to configure the IBM IOC with data sources and integrate arcGIS with IOC.

 

Keep Reading !

1 comment:

  1. Hi , Thanks for your post .It really helped me .When will you be posting next article on Integration arcGIS with IOC. Eagerly waiting.

    ReplyDelete