To handle occurrences of exceptions and special conditions that change the normal flow of the program execution, error handling has to be done appropriately.
public void onError(ISDMRequest aRequest, IHttpResponse aResponse, ISDMRequestStateElement aRequestStateElement)) { int errCode = aRequestStateElement.getErrorCode(); String str = new String(aResponse.getContent()); serviceDocument = "Error Code: "+ errCode + str; }