use of org.apache.axis.encoding.TypeMappingRegistry in project tomee by apache.
the class SeiFactoryImpl method initialize.
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);
}
Aggregations