PHP at Bloomberg's - 4

Part four, requesting data (this post)

In the last post (which I hoped to be the last) in the series PHP at Bloomberg’s I described how you fetch a result with a responseId after you have requested information from Bloomberg’s.
Having shown the ‘retrieve app’ for the business owner I was asked “Can’t you request an information set in one shot mode, and then retrieve the result”. “Why do you want to do that? We schedule a request periodically at Bloomberg and then we just retrieve the result when time is due and have ever green data. Schedule once fetch fresh data forever” I responded. “Schedule periodically at Bloomberg has contractual implications. We like to be able to schedule ourselves. We like the abillity to request "one shot" or “ad hoc” reports then fetch the result, and schedule this daily. We know this is more cumbersome, but can you have try?”  
Easy I thought, first I create a job to send the request to Bloomberg and then wait for the report to be produced:
Then I had to modify the PHP code from the previous post a bit. In the original code I create the parameter list directly in the PHP code as it is just a one liner:

But here the parameter list is hundreds of lines. I decided to specify the list as plain XML text following Bloomberg SOAP standard, (you see it above in the <soaprequest> tag). And add code to convert it to an array:

I added a <top> node making the XML well formed and via JSON encode/decode created a perfect array for the soap request.
Then I just run the job and after a few tries it worked. This was easy, unfortunately it turned out to not be as easy with the scheduling. Right now I’m thinking about how to solve the scheduling, but there are some twists to it that I don’t get my head around. When the scheduling is done I might write yet another post about PHP at Bloomberg’s.

No comments:

Post a Comment