Created
November 2, 2012 12:49
-
-
Save bjhaid/4001191 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private RIMXMLResponseDetail processRIMResponse(String response) | |
{ | |
RIMXMLResponseDetail rimXMLResponseDetail = new RIMXMLResponseDetail(); | |
try | |
{ | |
document = DocumentHelper.parseText(response); | |
if ( document.selectSingleNode("//ProvisioningReply/Body/ProvisioningEntity/ProvisioningDataItem[@name='BillingId']") == null){ | |
Node billingID = document.selectSingleNode("//ProvisioningReply/Body/ProvisioningEntity/ProvisioningDataItem[@name='IMSI']"); | |
rimXMLResponseDetail.setImsi(billingID.getText()); | |
} | |
else { | |
Node billingID = document.selectSingleNode("//ProvisioningReply/Body/ProvisioningEntity/ProvisioningDataItem[@name='IMSI']"); | |
rimXMLResponseDetail.setImsi(billingID.getText()); | |
} | |
//Node billingID = document.selectSingleNode("//ProvisioningReply/Body/ProvisioningEntity/ProvisioningDataItem[@name='BillingId']"); | |
Node serviceName = document. | |
selectSingleNode("//ProvisioningReply/Body/ProvisioningEntity/ProvisioningEntity/ProvisioningDataItem[@name='ServiceName']"); | |
Node node = document.selectSingleNode("//ProvisioningReply/Body/ProvisioningEntity/ProvisioningEntity/TransactionCode"); | |
if (serviceName != null) | |
rimXMLResponseDetail.setServiceName(serviceName.getText()); | |
if (node == null) | |
{ | |
node = document.selectSingleNode("//ProvisioningReply/Body/ProvisioningEntity/TransactionCode"); | |
} | |
Node nodeName = document.selectSingleNode(node.getUniquePath()+"/ErrorCode"); | |
Node nodeValue = document.selectSingleNode(node.getUniquePath()+"/ErrorDescription"); | |
if (nodeName != null && nodeValue != null) | |
{ | |
rimXMLResponseDetail.setErrorCode(nodeName.getText()); | |
rimXMLResponseDetail.setErrorDescription(nodeValue.getText()); | |
} | |
else | |
{ | |
nodeName = document.selectSingleNode(node.getUniquePath()+"/StatusCode"); | |
nodeValue = document.selectSingleNode(node.getUniquePath()+"/StatusDescription"); | |
if (nodeName != null && nodeValue != null) | |
{ | |
rimXMLResponseDetail.setErrorCode(nodeName.getText()); | |
rimXMLResponseDetail.setErrorDescription(nodeValue.getText()); | |
} | |
} | |
} | |
catch(DocumentException ex) | |
{ | |
ex.printStackTrace(); | |
return null; | |
} | |
System.out.println(rimXMLResponseDetail); | |
return rimXMLResponseDetail; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment