getProfile(String sessionID)
![]() |
sessionID - 用于标识会话标识的字符串。
|
response = api.getProfile(sessionId);
/** Process the response appropriately */
// check if response is successful or not
if(response.getStatusCode() == Response.STATUS_SUCCESS)
{
System.out.println("getProfile call processed with no warnings or errors");
// Print the profile - it's just an array of NameValuePair objects
for(NameValuePair nvp : response.getProfileRecord())
{
System.out.println("Name:"+nvp.getName());
if(nvp.getValueDataType().equals(NameValuePair.DATA_TYPE_DATETIME))
{
System.out.println("Value:"+nvp.getValueAsDate());
}
else if(nvp.getValueDataType().equals(NameValuePair.DATA_TYPE_NUMERIC))
{
System.out.println("Value:"+nvp.getValueAsNumeric());
}
else
{
System.out.println("Value:"+nvp.getValueAsString());
}
}
}
else if(response.getStatusCode() == Response.STATUS_WARNING)
{
System.out.println("getProfile call processed with a warning");
}
else
{
System.out.println("getProfile call processed with an error");
}
// For any non-successes, there should be advisory messages explaining why
if(response.getStatusCode() != Response.STATUS_SUCCESS)
printDetailMessageOfWarningOrError("getProfile",
response.getAdvisoryMessages());
Copyright IBM Corporation 2014. All Rights Reserved.
|