1 57 58 package clients.zipcode; 59 60 import java.io.IOException ; 61 import java.io.Writer ; 62 63 import org.apache.soap.Utils; 64 import org.apache.soap.rpc.SOAPContext; 65 import org.apache.soap.util.Bean; 66 import org.apache.soap.util.xml.NSStack; 67 import org.apache.soap.util.xml.QName; 68 import org.apache.soap.util.xml.XMLJavaMappingRegistry; 69 import org.apache.wsif.providers.soap.apachesoap.PartSerializer; 70 import org.w3c.dom.Element ; 71 import org.w3c.dom.Node ; 72 73 77 public class LiteralSerializer implements PartSerializer { 78 79 private Object customBean; 80 private javax.xml.namespace.QName customBeanQName; 81 82 85 public void setPart(Object aCustomBean) { 86 this.customBean = aCustomBean; 87 } 88 89 92 public Object getPart() { 93 return this.customBean; 94 } 95 96 public Object getPart(Class resultClass) { 97 return null; 98 } 99 102 public void marshall( 103 String inScopeEncStyle, 104 Class javaType, 105 Object src, 106 Object context, 107 Writer sink, 108 NSStack nsStack, 109 XMLJavaMappingRegistry xjmr, 110 SOAPContext ctx) 111 throws IllegalArgumentException , IOException { 112 113 PartFormatHandler fh = new ShortZipCodeFormatHandler(); 115 fh.setCustomBean(customBean); 116 fh.setCustomBeanQName(this.customBeanQName); 117 Element element = fh.getElement(); 118 Utils.marshallNode((Node ) element, sink); 119 } 120 121 124 public Bean unmarshall( 125 String inScopeEncStyle, 126 QName elementType, 127 Node src, 128 XMLJavaMappingRegistry xjmr, 129 SOAPContext ctx) 130 throws IllegalArgumentException { 131 PartFormatHandler fh = new ShortZipCodeResponseFormatHandler(); 134 fh.setElement((Element ) src); 135 this.customBean = fh.getCustomBean(); 136 return new Bean(this.customBean.getClass(), this.customBean); 137 } 138 139 private PartFormatHandler getFormatHandler(Object bean, QName namespace) { 140 141 return null; 145 } 146 147 151 public javax.xml.namespace.QName getPartQName() { 152 return customBeanQName; 153 } 154 155 159 public void setPartQName(javax.xml.namespace.QName customBeanQName) { 160 this.customBeanQName = customBeanQName; 161 162 } 163 164 } 165 | Popular Tags |