1 4 5 9 10 package org.openlaszlo.remote.soap; 11 12 import java.math.BigDecimal ; 13 import java.net.URI ; 14 import javax.xml.namespace.QName ; 15 import javax.xml.rpc.ParameterMode ; 16 import javax.xml.rpc.ServiceException ; 17 import org.apache.axis.Constants; 18 import org.apache.log4j.Logger; 19 20 public class LZSOAPPart 21 { 22 public static Logger mLogger = Logger.getLogger(LZSOAPPart.class); 23 24 String mName = null; 25 String mElement = null; 26 ComplexType mType = null; 27 28 ParameterMode mParameterMode = ParameterMode.IN; 30 31 public LZSOAPPart(String name) { 32 mName = name; 33 } 34 35 public String getName() { 36 return mName; 37 } 38 39 public String getElement() { 40 return mElement; 41 } 42 43 public ComplexType getType() { 44 return mType; 45 } 46 47 public ParameterMode getParameterMode() { 48 return mParameterMode; 49 } 50 51 public void setName(String name) { 52 mName = name; 53 } 54 55 public void setElement(String element) { 56 mElement = element; 57 } 58 59 public void setType(ComplexType type) { 60 mType = type; 61 } 62 63 public void setParameterMode(ParameterMode parameterMode) { 64 mParameterMode = parameterMode; 65 } 66 67 73 public Object valueOf(String param) 74 throws ServiceException { 75 76 try { 79 80 88 QName typeQName = mType.getName(); 89 if (Constants.equals(Constants.XSD_INT, typeQName)) { 90 return Integer.valueOf(param); 91 } else if (Constants.equals(Constants.XSD_LONG, typeQName)) { 92 return Long.valueOf(param); 93 } else if (Constants.equals(Constants.XSD_FLOAT, typeQName)) { 94 return Float.valueOf(param); 95 } else if (Constants.equals(Constants.XSD_DOUBLE, typeQName)) { 96 return Double.valueOf(param); 97 } else if (Constants.equals(Constants.XSD_BOOLEAN, typeQName)) { 98 return Boolean.valueOf(param); 99 } else if (Constants.equals(Constants.XSD_DECIMAL, typeQName)) { 100 return new BigDecimal (param); 101 } else if (Constants.equals(Constants.XSD_SHORT, typeQName)) { 102 return Short.valueOf(param); 103 } else if (Constants.equals(Constants.XSD_BYTE, typeQName)) { 104 return Byte.valueOf(param); 105 } else if (Constants.equals(Constants.XSD_ANYURI, typeQName)) { 106 return new URI (param); 107 } 108 return param; 109 } catch (Exception e) { 110 mLogger.error(e.getMessage()); 111 throw new ServiceException (e.getMessage()); 112 } 113 } 114 115 public void toXML(StringBuffer sb) { 116 sb.append("<part ") 117 .append(" name=\"").append(mName).append("\"") 118 .append(" element=\"").append(mElement).append("\"") 119 .append(" type=\"").append(mType.getName()).append("\"") 120 .append(" parameterMode=\"").append(mParameterMode).append("\"") 121 .append("/>"); 122 } 123 } 124 | Popular Tags |