1 16 17 20 package org.apache.axis.deployment.wsdd; 21 22 import org.apache.axis.description.FaultDesc; 23 import org.apache.axis.encoding.SerializationContext; 24 import org.apache.axis.utils.XMLUtils; 25 import org.w3c.dom.Element ; 26 import org.xml.sax.helpers.AttributesImpl ; 27 28 import javax.xml.namespace.QName ; 29 import java.io.IOException ; 30 31 public class WSDDFault extends WSDDElement { 32 FaultDesc desc; 33 34 public WSDDFault(FaultDesc desc) { 35 this.desc = desc; 36 } 37 38 43 public WSDDFault(Element e) throws WSDDException { 44 super(e); 45 46 desc = new FaultDesc(); 47 48 String nameStr = e.getAttribute(ATTR_NAME); 49 if (nameStr != null && !nameStr.equals("")) 50 desc.setName(nameStr); 51 52 String qNameStr = e.getAttribute(ATTR_QNAME); 53 if (qNameStr != null && !qNameStr.equals("")) 54 desc.setQName(XMLUtils.getQNameFromString(qNameStr, e)); 55 56 String classNameStr = e.getAttribute(ATTR_CLASS); 57 if (classNameStr != null && !classNameStr.equals("")) 58 desc.setClassName(classNameStr); 59 60 String xmlTypeStr = e.getAttribute(ATTR_TYPE); 61 if (xmlTypeStr != null && !xmlTypeStr.equals("")) 62 desc.setXmlType(XMLUtils.getQNameFromString(xmlTypeStr, e)); 63 } 64 65 68 protected QName getElementName() { 69 return QNAME_FAULT; 70 } 71 72 75 public void writeToContext(SerializationContext context) 76 throws IOException { 77 AttributesImpl attrs = new AttributesImpl (); 78 79 attrs.addAttribute("", ATTR_QNAME, ATTR_QNAME, 80 "CDATA", 81 context.qName2String(desc.getQName())); 82 83 attrs.addAttribute("", ATTR_CLASS, ATTR_CLASS, 84 "CDATA", desc.getClassName()); 85 86 attrs.addAttribute("", ATTR_TYPE, ATTR_TYPE, 87 "CDATA", 88 context.qName2String(desc.getXmlType())); 89 90 context.startElement(getElementName(), attrs); 91 context.endElement(); 92 } 93 94 public FaultDesc getFaultDesc() { 95 return desc; 96 } 97 98 public void setFaultDesc(FaultDesc desc) { 99 this.desc = desc; 100 } 101 } 102 | Popular Tags |