1 package org.apache.axis2.soap.impl.llom.soap11; 2 3 import org.apache.axis2.om.OMElement; 4 import org.apache.axis2.om.OMOutput; 5 import org.apache.axis2.om.OMXMLParserWrapper; 6 import org.apache.axis2.om.impl.llom.OMSerializerUtil; 7 import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter; 8 import org.apache.axis2.soap.SOAPFault; 9 import org.apache.axis2.soap.impl.llom.SOAPFaultDetailImpl; 10 import org.apache.axis2.soap.impl.llom.SOAPProcessingException; 11 12 import javax.xml.stream.XMLStreamException; 13 import javax.xml.stream.XMLStreamWriter; 14 15 32 33 public class SOAP11FaultDetailImpl extends SOAPFaultDetailImpl { 34 public SOAP11FaultDetailImpl(SOAPFault parent) throws SOAPProcessingException { 35 super(parent, false); 36 } 37 38 public SOAP11FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder) { 39 super(parent, builder); 40 } 41 42 protected void checkParent(OMElement parent) throws SOAPProcessingException { 43 if (!(parent instanceof SOAP11FaultImpl)) { 44 throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP Fault as the parent. But received some other implementation"); 45 } 46 } 47 48 56 public void serialize(OMOutput omOutput, boolean cache) throws XMLStreamException { 57 58 short builderType = PULL_TYPE_BUILDER; if (builder != null) { 61 builderType = this.builder.getBuilderType(); 62 } 63 if ((builderType == PUSH_TYPE_BUILDER) 64 && (builder.getRegisteredContentHandler() == null)) { 65 builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput)); 66 } 67 XMLStreamWriter writer = omOutput.getXmlStreamWriter(); 68 if (this.getNamespace() != null) { 69 String prefix = this.getNamespace().getPrefix(); 70 String nameSpaceName = this.getNamespace().getName(); 71 writer.writeStartElement(prefix, SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, 72 nameSpaceName); 73 }else{ 74 writer.writeStartElement(SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME); 75 } 76 OMSerializerUtil.serializeAttributes(this, omOutput); 77 OMSerializerUtil.serializeNamespaces(this, omOutput); 78 79 80 String text = this.getText(); 81 writer.writeCharacters(text); 82 83 84 if (firstChild != null) { 85 firstChild.serialize(omOutput); 86 } 87 writer.writeEndElement(); 88 89 if (this.nextSibling != null) { 91 nextSibling.serialize(omOutput); 92 } 93 94 } 95 96 97 } 98 | Popular Tags |