caio.cavalcanti

Using doSelect() from CAs Webservice

3 posts in this topic

Hello there!

I'm working with CA's webservice to retrieve several information about requests. I'm currently using the "doSelect()" method, which seems pretty straightforward. I don't have any issue about setting up the webservice nor getting the requests with the fields I need.

Just for the sake of completeness, this is the "doSelect()" with the parameters:

doSelect(mySID, objectType, whereClause, maxRows, attributes);

doSelect(mySID, “cr”, “ref_num LIKE 'ref42', -1, myArray);

And I'm using the results to build performance indicators (SLAs, KPIs, etc): on time requests, mean service time, etc etc. Most of our indicators are monthly, meaning on the beginning of each month, I'll have my extractor run (having closed date setting for the month before), do some math and populate a table with the results.

My question is this: going through CAs documents, I stumbled upon this statement:

"Note: Regardless of the integer specified, CA SDM will return a maximum of 250 rows per call."

This is very, very bad for me, since there are categories that will have 250 requests PER DAY. It seems unreasonable for me to build an extractor to run on a daily basis. I wanted to do this monthly.

So, my question is:

1) is there a way to sort, somehow? Because I'm thinking that, if I can sort the results, I can get the last ID (or ref_num), and make successive queries until I get all the requests.

2) if not, has anyone been through this issue? If so, is there a better way to do this? Is there a workaround?

Release: r12.7

Version: 'asp-919'

Thanks a lot in advance!

Edited by caio cavalcanti

Share this post


Link to post
Share on other sites

You can do it in three steps.

First you run query and get a handle to list of results.

Then You fetch content of that list.

And then You parse xml of the result.

I did it by concatenating xml-s of each portion into one big xml (just remove unneccessary tags from the middle ones) and then parse it.

Here is example code (java - you need to polish it to use nicely):

Rport object is a object to make nice outputs, You can change it to printf or something.

String xmlwynikowy="";

try {

ListResult doQueryResult = new ListResult();

doQueryResult = service.doQuery(sid, "nr", query);

int listHandle = doQueryResult.getListHandle();

int listLength = doQueryResult.getListLength();

report.setLog("doSelectList","found " + listLength + " matched ci. query:"+query , "timed","nostdout");

report.setIloscCIzSDM(listLength);

report.setValue("SDM Wczytano na listę - doSelectList", Integer.toString(listLength));

int startIndex = 0;

int endIndex;

boolean doMore = false;

if (listLength > 0) {

doMore = true;

}

while ( doMore ) {

if (listLength > (startIndex + 200)){

endIndex = startIndex + 199;

} else {

endIndex = listLength - 1;

doMore = false;

}

report.setLog("doSelectList","Output of startIndex: " + startIndex + " to endIndex: " + endIndex , "timed","nostdout");

String lResult = service.getListValues(sid, listHandle, startIndex, endIndex, atrybuty);

lResult=lResult.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");

lResult=lResult.replace("<UDSObjectList>", "");

lResult=lResult.replace("</UDSObjectList>", "");

xmlwynikowy=xmlwynikowy+lResult.trim();

if ( doMore ) {

startIndex += 200;

}

}

// Free the list.

int[] handleList = new int[1];

handleList[0]=new java.lang.Integer(listHandle) ;

service.freeListHandles(sid, handleList);

} catch (RemoteException re){

doLog("doSelectCI - error, query "+query+" : exception: <PRE>"+re.getMessage()+"</PRE><BR>\n");

return "";

}

return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<UDSObjectList>"+xmlwynikowy+"\n</UDSObjectList>";

}

Share this post


Link to post
Share on other sites
On 7/29/2014 at 3:25 PM, ptoki said:

You can do it in three steps.

First you run query and get a handle to list of results.

Then You fetch content of that list.

And then You parse xml of the result.

I did it by concatenating xml-s of each portion into one big xml (just remove unneccessary tags from the middle ones) and then parse it.

Here is example code (java - you need to polish it to use nicely):

Rport object is a object to make nice outputs, You can change it to printf or something.

String xmlwynikowy="";

try {

ListResult doQueryResult = new ListResult();

doQueryResult = service.doQuery(sid, "nr", query);

int listHandle = doQueryResult.getListHandle();

int listLength = doQueryResult.getListLength();

report.setLog("doSelectList","found " + listLength + " matched ci. query:"+query , "timed","nostdout");

report.setIloscCIzSDM(listLength);

report.setValue("SDM Wczytano na listę - doSelectList", Integer.toString(listLength));

int startIndex = 0;

int endIndex;

boolean doMore = false;

if (listLength > 0) {

doMore = true;

}

while ( doMore ) {

if (listLength > (startIndex + 200)){

endIndex = startIndex + 199;

} else {

endIndex = listLength - 1;

doMore = false;

}

report.setLog("doSelectList","Output of startIndex: " + startIndex + " to endIndex: " + endIndex , "timed","nostdout");

String lResult = service.getListValues(sid, listHandle, startIndex, endIndex, atrybuty);

lResult=lResult.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");

lResult=lResult.replace("<UDSObjectList>", "");

lResult=lResult.replace("</UDSObjectList>", "");

xmlwynikowy=xmlwynikowy+lResult.trim();

if ( doMore ) {

startIndex += 200;

}

}

// Free the list.

int[] handleList = new int[1];

handleList[0]=new java.lang.Integer(listHandle) ;

service.freeListHandles(sid, handleList);

} catch (RemoteException re){

doLog("doSelectCI - error, query "+query+" : exception: <PRE>"+re.getMessage()+"</PRE><BR>\n");

return "";

}

return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<UDSObjectList>"+xmlwynikowy+"\n</UDSObjectList>";

}

Hello Everyone,

 

is there an equivalent VB code for this? I'm just new in using SDM integration and we are using VB in programming. I kind of understand most of the parts in the above code. just need to find an equivalent for the below specific lines in VB

ListResult doQueryResult = new ListResult(); how is this implemented in VB?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Announcements

    • Gregg

      12/20/2015

      Until I can transfer the wiki content over to the new Articles, you can find the old content here: http://www.greggsmith.net/wiki.
    • Gregg

      01/06/2016

      A special thanks to brianshs for creating a new site logo!