org.apache.axis.description.TypeDesc Java Examples
The following examples show how to use
org.apache.axis.description.TypeDesc.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AxisUtil.java From j-road with Apache License 2.0 | 6 votes |
public static String serialize(Object obj) throws IOException { TypeDesc desc = TypeDesc.getTypeDescForClass(obj.getClass()); BeanSerializer serializer = new BeanSerializer(obj.getClass(), desc.getXmlType(), desc); MessageContext mctx = new MessageContext(null); mctx.setProperty(AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION, true); mctx.setProperty(AxisEngine.PROP_SEND_XSI, true); mctx.setTypeMappingRegistry(new TypeMappingRegistryImpl()); StringWriter writer = new StringWriter(); SerializationContext ctx = new SerializationContext(writer, mctx); ctx.setPretty(false); ctx.setSendDecl(true); ctx.setDoMultiRefs(false); serializer.serialize(new QName("keha"), new AttributesImpl(), obj, ctx); return writer.getBuffer().toString(); }
Example #2
Source File: SeiFactoryImpl.java From tomee with Apache License 2.0 | 5 votes |
void initialize(Object serviceImpl, ClassLoader classLoader) throws ClassNotFoundException { this.serviceImpl = serviceImpl; Class serviceEndpointBaseClass = classLoader.loadClass(serviceEndpointClassName); serviceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointBaseClass, classLoader); Class[] constructorTypes = new Class[]{classLoader.loadClass(GenericServiceEndpoint.class.getName())}; this.constructor = FastClass.create(serviceEndpointClass).getConstructor(constructorTypes); this.handlerInfoChainFactory = new HandlerInfoChainFactory(handlerInfos); sortedOperationInfos = new OperationInfo[FastClass.create(serviceEndpointClass).getMaxIndex() + 1]; String encodingStyle = ""; for (int i = 0; i < operationInfos.length; i++) { OperationInfo operationInfo = operationInfos[i]; Signature signature = operationInfo.getSignature(); MethodProxy methodProxy = MethodProxy.find(serviceEndpointClass, signature); if (methodProxy == null) { throw new ServerRuntimeException("No method proxy for operationInfo " + signature); } int index = methodProxy.getSuperIndex(); sortedOperationInfos[index] = operationInfo; if (operationInfo.getOperationDesc().getUse() == Use.ENCODED) { encodingStyle = org.apache.axis.Constants.URI_SOAP11_ENC; } } //register our type descriptors Service service = ((ServiceImpl) serviceImpl).getService(); AxisEngine axisEngine = service.getEngine(); TypeMappingRegistry typeMappingRegistry = axisEngine.getTypeMappingRegistry(); TypeMapping typeMapping = typeMappingRegistry.getOrMakeTypeMapping(encodingStyle); typeMapping.register(BigInteger.class, Constants.XSD_UNSIGNEDLONG, new SimpleSerializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG), new SimpleDeserializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG)); typeMapping.register(URI.class, Constants.XSD_ANYURI, new SimpleSerializerFactory(URI.class, Constants.XSD_ANYURI), new SimpleDeserializerFactory(URI.class, Constants.XSD_ANYURI)); //It is essential that the types be registered before the typeInfos create the serializer/deserializers. for (Iterator iter = typeInfo.iterator(); iter.hasNext(); ) { TypeInfo info = (TypeInfo) iter.next(); TypeDesc.registerTypeDescForClass(info.getClazz(), info.buildTypeDesc()); } TypeInfo.register(typeInfo, typeMapping); }
Example #3
Source File: AxisSerializer.java From googleads-java-lib with Apache License 2.0 | 5 votes |
/** * Uses reflection to get the QName XmlType. */ private <T extends Serializable> QName getXmlType(Class<T> clazz) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { Method getTypeDesc = clazz.getMethod("getTypeDesc"); TypeDesc typeDesc = (TypeDesc) getTypeDesc.invoke(null); return typeDesc.getXmlType(); }
Example #4
Source File: DataAndEventId.java From Cynthia with GNU General Public License v2.0 | 4 votes |
public static TypeDesc getTypeDesc() { return typeDesc; }
Example #5
Source File: Key.java From Cynthia with GNU General Public License v2.0 | 4 votes |
public static TypeDesc getTypeDesc() { return typeDesc; }
Example #6
Source File: TypeInfo.java From tomee with Apache License 2.0 | 4 votes |
public TypeDesc buildTypeDesc() { TypeDesc typeDesc = new TypeDesc(clazz, canSearchParents); typeDesc.setXmlType(qName); typeDesc.setFields(fields); return typeDesc; }