MicroStrategy TaskProc Enhancement in 9.2 SDK

One thing that you’ll notice when trying to use the TaskProc as a method of feeding MicroStrategy data into an external application is that the various options for results are none too friendly.  The XML options are all very bloated with metadata/formatting overhead and the other delivery packages are just wrappers for the XML, so they make it worse.  The handy ReportViewer style that can be used with the Web Services to get clean and compact data isn’t supported by TaskProc for some reason.

Traditionally, this has been enough to deter me from using TaskProc as my go to choice for data extraction from MicroStrategy, but a hidden little gem in the 9.2 Web SDK gets all of that fixed.  I’m not sure why it’s not out of the box, but perhaps in the future it will be.  For now, check out this cool plugin that will make TaskProc a lot more powerful.

Note: For details on using the TaskProc, check out the post Getting Started with MicroStrategy TaskProc

The plugin is called RetrievingReportXMLCustomFormat and can be found in your local installed SDKCustomizationPluginsAdvancedScenarios in both ASP and JSP flavors.  Simply copy the plugin folder to your Webplugins folder and restart your web server for it to be loaded.  Then, when you use the Task Processor, set your styleName parameter to CustomXMLReportStyle to use this new plugin.  The output is now clean and precise XML that just contains the data for the report, which is really the only part you’ll care about if you’re feeding data to an external application.

As a bonus tip, my original post for the TaskProc used reportExecute as a method, which requires a separate TaskProc call to create a Session first.  A faster way to accomplish a data read from MicroStrategy is to use the reportDataService call instead.  I’ve had trouble with this task in the past (it was broken in 9.0.2 GA) but it looks like everything is working great in 9.2.  The difference is that this task will perform the session open/close and report execute all in one, preventing the need for the separate calls.  When I tested this with 9.2, the speed was spectacular, and even a little faster than the reportExecute method from 9.0.2.

You may also like...

15 Responses

  1. Kevin King says:

    So, I have successfully got my reportDataService API implemented, but I have a question about the return XML. In MSTR, looking at the report, it doesn’t have merged rows – meaning it doesn’t repeat data that was the same on the previous row. You can turn on Merged Rows, but the data that comes across in XML still has the superflous data missing. Have you encountered this? I can see how not having it merged can lessen the payload size, but I’m not sure if there is an easy way to “figure it out” in code.


    • Bryan says:

      I haven’t encountered that. I don’t regularly use this method, but now that I think about it, the test cases I’ve used have been simple and didn’t include repeating rows. Turning on Merged Rows is the only suggestion I’d have (and you tried that). I guess as long as the first row in a set comes back with the value, you can just programmaticly keep track of it and fill the holes. I believe the source code for this is in the SDK Sample in java. Perhaps it’s fixable.

    • Kevin King says:

      Thanks for replying Bryan!

      Ok, that’s exactly where we were headed – somehow intelligently knowing that it actually belonged to the previous row – or they shared attributes. The tough part is that in each row, it doesn’t tell you which column the value belongs to. In other words, if I’m repeating the “Name” column for two rows (the 2nd row wouldn’t have “Name”), I wouldn’t know if the value that was there was the “Name” or the next column, make sense? We’ve discussed putting indicators on the actual value; for instance, if we have 3 columns, “Company”, “Name”, “Salary”, we’d end up with rows like this:

      [col value=”Google” /]
      [col value=”Bryan” /]
      [col value=”1,000,000″ /]
      [col value=”Kevin” /]
      [col value=”100,000″ /]

      Now, we don’t know if “Kevin” is a company or a name, because the column doesn’t tell us the actual attribute. Because we are both at Google, it ignores it for my row. But, what if our columns looked like this, where we put the column index pipe delimited with the value? Seems hacky, and if we could add other attributes to the XML [col>, we could put it in there.

      [col value=”1|Google” /]
      [col value=”2|Bryan” /]
      [col value=”3|1,000,000″ /]
      [col value=”2|Kevin” /]
      [col value=”3|100,000″ /]

      Whatcha think?

  2. Kevin King says:

    I figured it out…

    It actually does that to preserve space in the payload.

    If you know your data, it isn’t too tough to decipher.


  3. Kevin King says:

    Hey Bryan,

    This is unrelated to my previous posts, but we are having an issue with authentication on the MSTR web server.

    We are calling the taskproc from a WCF service, and expect to get XML returned and then parsed, and then sent off to another application.

    With anonymous access enabled, the request takes 5-10 seconds. Through the browser, it takes 1-2 seconds.

    With anonymous access disabled, and the HttpWebRequest (C#.net) passing credentials, it takes 50+ seconds.

    What are we doing wrong do you think?


    • Bryan says:

      Sorry, I’m not too familiar on the authentication overheads. The best I could suggest is using WireShark to monitor the transaction and see where the delay is. Check the IIS logs to see if it’s failing/timing out/retrying. Hopefully you’ll find some clues there.

  4. Thanks for the tip Bryan!! I was really in need of getting the xml output without all the formatting and looks like i can use this plugin.
    But i get an error when i try to use RetrievingReportXMLCustomFormat plugin..please see below the invoked URL and error msg.
    i am not sure what the issue is..all the other plugins work.


    On a separate note, I am trying to pass the prompt answers to a report and it always gives me the below error msg. I am able to execute the report with the default prompt answers though. Please see below the webservices URL, i get the same msg while using task based url


    Object executed is in prompt status. Please resolve prompts and use the message ID.

    please share your thoughts on these two issues and let me know if i am missing anything.

    thanks for your help,

    • Bryan says:

      For the 2nd issue (since you already solved the 1st, as noted below), I noticed that you have misspelled “passwpord”. I’m also not sure that all of those %20’s are correct as values for password, authMode, port and startCol (I’ve never used startCol). Try removing all of those.

  5. I missed the error msg1 in my previous comment:
    please see below:

    errorMsg=”Task encountered a null pointer exception: com.microstrategy.web.app.tasks.AbstractDataServiceTask.invokeTask”

  6. Bryan, i figured out the first issue so just wanted to share, for JSP we need to copy the folder(1 level below) inside the main plugin folder

    folder to copy

    C:Program Files (x86)MicroStrategySDKCustomizationPluginsAdvancedScenariosRetrievingReportXMLCustomFormatRetrievingReportXMLCustomFormat

    not the main folder

    C:Program Files (x86)MicroStrategySDKCustomizationPluginsAdvancedScenariosRetrievingReportXMLCustomFormat

  7. thanks Bryan!!will try it out..

  8. Nilesh Sahni says:


    We are at MicroStrategy 9.2.1 and still getting “Caused by: java.net.SocketException: Broken pipe” exception.

    We are not using this for report execution. But trying to get session state so that we can call other “tasks” like “folderBrowse”.

    This is coming then we are trying to create a session. Below is the complete trace:
    [com.microstrategy.webapi SEVERE] [11/21/2012 11:43:26:653] [189] [] [] [MSIMsgBuf.SendToChannel] MsiNetStreamI : Write error. (com.microstrategy.webapi.MSTRWebAPIExcep
    tion) 0x80043702: [com.microstrategy.webapi.MSTRWebAPIException: MsiNetStreamI : Write error.
    at com.microstrategy.webapi.MSIMsgBuf.SendToChannel(Unknown Source)
    at com.microstrategy.webapi.CDSSMsg.SendToChannel(Unknown Source)

    Caused by: java.net.SocketException: Broken pipe

    Please let us know if there is any work around or solution for this.

    • Bryan says:

      That error means the connection was lost (or not able to be open). I haven’t seen it come from TaskProc, but sounds like more of an environmental error than any kind of coding error. What’s the URL that you’re invoking?

  9. Filip says:

    Link to “Getting Started with MicroStrategy TaskProc” does not work …

Leave a Reply

Your email address will not be published. Required fields are marked *