* @throws XMLStreamException For errors during reading.
*/
public SoapFault parseSoapFault(final XMLStreamReader streamReader)
throws XMLStreamException
{
final SoapFault10 soapFault = new SoapFault10() ;
// Code processing
StreamHelper.checkNextStartTag(streamReader, QNAME_CODE) ;
StreamHelper.checkNextStartTag(streamReader, QNAME_VALUE) ;
final TextElement codeElement = new TextElement(streamReader) ;
final QName code = QNameHelper.toQName(streamReader.getNamespaceContext(), codeElement.getText()) ;
soapFault.setSoapFaultType(getSoapFaultType(code)) ;
if (!StreamHelper.checkParentFinished(streamReader))
{
StreamHelper.checkTag(streamReader, QNAME_SUBCODE) ;
StreamHelper.checkNextStartTag(streamReader, QNAME_VALUE) ;
final TextElement subcodeElement = new TextElement(streamReader) ;
soapFault.setSubcode(QNameHelper.toQName(streamReader.getNamespaceContext(), subcodeElement.getText())) ;
if (!StreamHelper.checkParentFinished(streamReader))
{
StreamHelper.checkTag(streamReader, QNAME_SUBCODE) ;
StreamHelper.checkNextStartTag(streamReader, QNAME_VALUE) ;
final TextElement subSubcodeElement = new TextElement(streamReader) ;
soapFault.setSubSubcode(QNameHelper.toQName(streamReader.getNamespaceContext(), subSubcodeElement.getText())) ;
if (!StreamHelper.checkParentFinished(streamReader))
{
// Throw away any subcodes as we only support two level.
new AnyElement(streamReader) ;
if (!StreamHelper.checkParentFinished(streamReader))
{
final String pattern = WSCLogger.log_mesg.getString("com.arjuna.webservices.soap.Soap12Details_1") ;
final String message = MessageFormat.format(pattern, new Object[] {streamReader.getName()}) ;
throw new XMLStreamException(message) ;
}
}
if (!StreamHelper.checkParentFinished(streamReader))
{
final String pattern = WSCLogger.log_mesg.getString("com.arjuna.webservices.soap.Soap12Details_1") ;
final String message = MessageFormat.format(pattern, new Object[] {streamReader.getName()}) ;
throw new XMLStreamException(message) ;
}
}
if (!StreamHelper.checkParentFinished(streamReader))
{
final String pattern = WSCLogger.log_mesg.getString("com.arjuna.webservices.soap.Soap12Details_1") ;
final String message = MessageFormat.format(pattern, new Object[] {streamReader.getName()}) ;
throw new XMLStreamException(message) ;
}
}
// Reason processing
StreamHelper.checkNextStartTag(streamReader, QNAME_REASON) ;
StreamHelper.checkNextStartTag(streamReader, QNAME_TEXT) ;
final TextElement reasonElement = new TextElement(streamReader) ;
soapFault.setReason(reasonElement.getText()) ;
if (!StreamHelper.checkParentFinished(streamReader))
{
final String pattern = WSCLogger.log_mesg.getString("com.arjuna.webservices.soap.Soap12Details_1") ;
final String message = MessageFormat.format(pattern, new Object[] {streamReader.getName()}) ;
throw new XMLStreamException(message) ;
}
if (StreamHelper.checkParentFinished(streamReader))
{
return soapFault ;
}
// Node if present
if (QNAME_NODE.equals(streamReader.getName()))
{
final TextElement nodeElement = new TextElement(streamReader) ;
soapFault.setNode(nodeElement.getText()) ;
if (StreamHelper.checkParentFinished(streamReader))
{
return soapFault ;
}
}
// Role if present
if (QNAME_ROLE.equals(streamReader.getName()))
{
final TextElement roleElement = new TextElement(streamReader) ;
soapFault.setRole(roleElement.getText()) ;
if (StreamHelper.checkParentFinished(streamReader))
{
return soapFault ;
}
}
// Detail if present
if (QNAME_DETAIL.equals(streamReader.getName()))
{
soapFault.setDetailElement(new NamedElement(null, new AnyElement(streamReader))) ;
if (StreamHelper.checkParentFinished(streamReader))
{
return soapFault ;
}
}