Author Topic: [SDK JAVA]: interpreting ConfServer Response  (Read 2532 times)

Offline sasu77

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
[SDK JAVA]: interpreting ConfServer Response
« on: September 13, 2016, 02:57:13 PM »
Hi,
  could you kindly help me to fix below Problem?

After that I estabilished the Connection with the Server, I wrote a simple method (mentioned below) but I'm not be able to retreive di XML. I got this message "[#document: null]"

Regards
Salvatore

------------------------------------------------------------------------------------------------------------------------
public void doQuery() {
KeyValueCollection filterKey = new KeyValueCollection();
filterKey.addObject("user_name", "XXXXXXXXX");

CfgObjectType objectType = CfgObjectType.CFGPerson;
int intPerson = objectType.asInteger();


RequestReadObjects requestFilterQuery =
RequestReadObjects.create(
intPerson,
filterKey);
 

try {
Message theMessage= protocol.request(requestFilterQuery);
EventObjectsRead objectsRead =
(EventObjectsRead) theMessage;
System.out.println(theMessage.messageName());
System.out.println("There are "+objectsRead.getObjectTotalCount()+ " objects of this type.");

System.out.println(objectsRead.getConfObject().toString());

} catch(Exception x){
System.out.println("ERRORE3: "+x.getStackTrace());
x.printStackTrace();
}

}

Offline hsujdik

  • Hero Member
  • *****
  • Posts: 541
  • Karma: 30
Re: [SDK JAVA]: interpreting ConfServer Response
« Reply #1 on: September 13, 2016, 03:38:33 PM »
My suggestion is to always try to use the ConfService instead of interpreting the XML. Way easier to deal with programatically. There is a post about it somewhere around the forum. I'll check if I can find the link and update here.

Here, try something like this:

http://www.sggu.com/smf/index.php/topic,9642.0.html