Search in sources :

Example 1 with HandlerInfoChainFactory

use of org.apache.axis.handlers.HandlerInfoChainFactory 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);
}
Also used : SimpleSerializerFactory(org.apache.axis.encoding.ser.SimpleSerializerFactory) HandlerInfoChainFactory(org.apache.axis.handlers.HandlerInfoChainFactory) Service(org.apache.axis.client.Service) URI(java.net.URI) SimpleDeserializerFactory(org.apache.axis.encoding.ser.SimpleDeserializerFactory) Signature(net.sf.cglib.core.Signature) MethodProxy(net.sf.cglib.proxy.MethodProxy) Iterator(java.util.Iterator) TypeMappingRegistry(org.apache.axis.encoding.TypeMappingRegistry) TypeMapping(org.apache.axis.encoding.TypeMapping) BigInteger(java.math.BigInteger) FastClass(net.sf.cglib.reflect.FastClass) ServerRuntimeException(org.apache.openejb.server.ServerRuntimeException) AxisEngine(org.apache.axis.AxisEngine)

Example 2 with HandlerInfoChainFactory

use of org.apache.axis.handlers.HandlerInfoChainFactory in project tomee by apache.

the class AxisService method createPojoWsContainer.

@Override
protected HttpListener createPojoWsContainer(ClassLoader loader, URL moduleBaseUrl, PortData port, String serviceId, Class target, Context context, String contextRoot, Map<String, Object> bdgs, ServiceConfiguration serviceInfos) throws Exception {
    ClassLoader classLoader = target.getClassLoader();
    // todo build JaxRpcServiceInfo in assembler
    JaxRpcServiceInfo serviceInfo = getJaxRpcServiceInfo(classLoader);
    // Build java service descriptor
    JavaServiceDescBuilder javaServiceDescBuilder = new JavaServiceDescBuilder(serviceInfo, classLoader);
    JavaServiceDesc serviceDesc = javaServiceDescBuilder.createServiceDesc();
    // Create service
    RPCProvider provider = new PojoProvider();
    SOAPService service = new SOAPService(null, provider, null);
    service.setServiceDescription(serviceDesc);
    // Set class name
    service.setOption("className", target.getName());
    // Add Handler Chain
    List<HandlerInfo> handlerInfos = createHandlerInfos(port.getHandlerChains());
    HandlerInfoChainFactory handlerInfoChainFactory = new HandlerInfoChainFactory(handlerInfos);
    service.setOption(org.apache.axis.Constants.ATTR_HANDLERINFOCHAIN, handlerInfoChainFactory);
    // Create container
    AxisWsContainer container = new AxisWsContainer(port.getWsdlUrl(), service, null, classLoader);
    wsContainers.put(serviceId, container);
    return container;
}
Also used : SOAPService(org.apache.axis.handlers.soap.SOAPService) JaxRpcServiceInfo(org.apache.openejb.server.axis.assembler.JaxRpcServiceInfo) HandlerInfoChainFactory(org.apache.axis.handlers.HandlerInfoChainFactory) JavaServiceDesc(org.apache.axis.description.JavaServiceDesc) RPCProvider(org.apache.axis.providers.java.RPCProvider) HandlerInfo(javax.xml.rpc.handler.HandlerInfo)

Aggregations

HandlerInfoChainFactory (org.apache.axis.handlers.HandlerInfoChainFactory)2 BigInteger (java.math.BigInteger)1 URI (java.net.URI)1 Iterator (java.util.Iterator)1 HandlerInfo (javax.xml.rpc.handler.HandlerInfo)1 Signature (net.sf.cglib.core.Signature)1 MethodProxy (net.sf.cglib.proxy.MethodProxy)1 FastClass (net.sf.cglib.reflect.FastClass)1 AxisEngine (org.apache.axis.AxisEngine)1 Service (org.apache.axis.client.Service)1 JavaServiceDesc (org.apache.axis.description.JavaServiceDesc)1 TypeMapping (org.apache.axis.encoding.TypeMapping)1 TypeMappingRegistry (org.apache.axis.encoding.TypeMappingRegistry)1 SimpleDeserializerFactory (org.apache.axis.encoding.ser.SimpleDeserializerFactory)1 SimpleSerializerFactory (org.apache.axis.encoding.ser.SimpleSerializerFactory)1 SOAPService (org.apache.axis.handlers.soap.SOAPService)1 RPCProvider (org.apache.axis.providers.java.RPCProvider)1 ServerRuntimeException (org.apache.openejb.server.ServerRuntimeException)1 JaxRpcServiceInfo (org.apache.openejb.server.axis.assembler.JaxRpcServiceInfo)1