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.SOAPFaultRoleImpl; 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 SOAP11FaultRoleImpl extends SOAPFaultRoleImpl { 34 public SOAP11FaultRoleImpl(SOAPFault parent) throws SOAPProcessingException { 35 super(parent, false); 36 } 37 38 public SOAP11FaultRoleImpl(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 protected void serialize(OMOutput omOutput, boolean cache) throws XMLStreamException { 49 50 short builderType = PULL_TYPE_BUILDER; if (builder != null) { 53 builderType = this.builder.getBuilderType(); 54 } 55 if ((builderType == PUSH_TYPE_BUILDER) 56 && (builder.getRegisteredContentHandler() == null)) { 57 builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput)); 58 } 59 60 XMLStreamWriter writer = omOutput.getXmlStreamWriter(); 61 if (this.getNamespace() != null) { 62 String prefix = this.getNamespace().getPrefix(); 63 String nameSpaceName = this.getNamespace().getName(); 64 writer.writeStartElement(prefix, SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME, 65 nameSpaceName); 66 } else { 67 writer.writeStartElement(SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME); 68 } 69 OMSerializerUtil.serializeAttributes(this,omOutput); 70 OMSerializerUtil.serializeNamespaces(this, omOutput); 71 72 String text = this.getText(); 73 writer.writeCharacters(text); 74 writer.writeEndElement(); 75 76 if (this.nextSibling != null) { 78 nextSibling.serialize(omOutput); 79 } else if (this.parent != null) { 80 if (!this.parent.isComplete()) { 81 builder.setCache(cache); 82 builder.next(); 83 } 84 } 85 86 } 87 88 89 } 90 | Popular Tags |