1 16 package org.apache.axis.message; 17 18 import org.apache.axis.AxisFault; 19 import org.apache.axis.InternalException; 20 import org.apache.axis.components.logger.LogFactory; 21 import org.apache.axis.encoding.DeserializationContext; 22 import org.apache.axis.utils.Messages; 23 import org.apache.axis.utils.XMLUtils; 24 import org.apache.commons.logging.Log; 25 import org.w3c.dom.Element ; 26 import org.xml.sax.Attributes ; 27 28 import javax.xml.namespace.QName ; 29 import javax.xml.soap.Name ; 30 import javax.xml.soap.SOAPElement ; 31 import javax.xml.soap.SOAPException ; 32 import java.io.InputStream ; 33 34 37 public class SOAPBodyElement extends MessageElement 38 implements javax.xml.soap.SOAPBodyElement { 39 40 private static Log log = 41 LogFactory.getLog(SOAPBodyElement.class.getName()); 42 43 public SOAPBodyElement(String namespace, 44 String localPart, 45 String prefix, 46 Attributes attributes, 47 DeserializationContext context) 48 throws AxisFault 49 { 50 super(namespace, localPart, prefix, attributes, context); 51 } 52 53 public SOAPBodyElement(Name name) 54 { 55 super(name); 56 } 57 58 public SOAPBodyElement(QName qname) 59 { 60 super(qname); 61 } 62 63 public SOAPBodyElement(QName qname, Object value) 64 { 65 super(qname, value); 66 } 67 68 public SOAPBodyElement(Element elem) 69 { 70 super(elem); 71 } 72 73 public SOAPBodyElement() 74 { 75 } 76 77 public SOAPBodyElement(InputStream input) 78 { 79 super( getDocumentElement(input) ); 80 } 81 82 public SOAPBodyElement(String namespace, String localPart) 83 { 84 super(namespace, localPart); 85 } 86 87 private static Element getDocumentElement(InputStream input) 88 { 89 try { 90 return XMLUtils.newDocument(input).getDocumentElement(); 91 } catch (Exception e) { 92 throw new InternalException(e); 93 } 94 } 95 96 public void setParentElement(SOAPElement parent) throws SOAPException { 97 if(parent == null) { 98 throw new IllegalArgumentException (Messages.getMessage("nullParent00")); 99 } 100 if (parent instanceof SOAPEnvelope) { 102 log.warn(Messages.getMessage("bodyElementParent")); 103 parent = ((SOAPEnvelope)parent).getBody(); 104 } 105 if (!(parent instanceof SOAPBody) && !(parent instanceof RPCElement)) { 106 throw new IllegalArgumentException (Messages.getMessage("illegalArgumentException00")); 107 } 108 109 super.setParentElement(parent); 110 } 111 112 } 113 | Popular Tags |