fail(exchange, new NullPointerException());
return;
}
if (!ssn.startsWith("1")) {
Fault fault = inOut.createFault();
fault.setContent(new StringSource(
"<invalidSSNFault xmlns=\"urn:logicblaze:soa:creditagency:types\"><ssn>"
+ ssn + "</ssn></invalidSSNFault>"));
fail(inOut, fault);
} else {
String operation = null;
if (inOut.getOperation() != null) {
operation = inOut.getOperation().getLocalPart();
} else {
operation = doc.getDocumentElement().getLocalName();
}
String output;
if ("getCreditScore".equals(operation)) {
output = "<getCreditScoreResponse xmlns=\"urn:logicblaze:soa:creditagency\"><score>"
+ getCreditScore(ssn) + "</score></getCreditScoreResponse>";
} else if ("getCreditHistoryLength".equals(operation)) {
output = "<getCreditHistoryLengthResponse xmlns=\"urn:logicblaze:soa:creditagency\"><length>"
+ getCreditHistoryLength(ssn) + "</length></getCreditHistoryLengthResponse>";
} else {
throw new UnsupportedOperationException(operation);
}
NormalizedMessage answer = inOut.createMessage();
answer.setContent(new StringSource(output));
answer(inOut, answer);
}
} catch (Exception e) {
throw new MessagingException(e);
}