alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Axis 2 example source code file (GenericProviderDispatcher.java)

This example Axis 2 source code file (GenericProviderDispatcher.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Axis 2 tags/keywords

abstractdispatcher, axisfault, axisfault, axisoperation, axisoperation, axisservice, genericproviderdispatcher, genericproviderdispatcher, log, messagecontext, override, override

The Axis 2 GenericProviderDispatcher.java source code

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.axis2.jaxws.dispatchers;

import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.AbstractDispatcher;
import org.apache.axis2.engine.SOAPActionBasedDispatcher;
import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.xml.namespace.QName;

/**
 * This dispatcher will look for a specific operation on the AxisService and return it
 * if found.  This dispatcher is used for Provider-based endpoints which do not have WSDL
 * associated with them.  Those types of endpoints will not have WSDL operations created for them
 * since (a) there is no WSDL and (b) there is no SEI from which to build operations using
 * annotations.  For these types of endpoints, a generic operation will have been added to the
 * service which will accept any incoming WSDL operation and pass the incoming message to the
 * Provider endpoint. 
 */
public class GenericProviderDispatcher extends AbstractDispatcher {
    private static final Log log = LogFactory.getLog(GenericProviderDispatcher.class);

    /* (non-Javadoc)
     * @see org.apache.axis2.engine.AbstractDispatcher#findOperation(org.apache.axis2.description.AxisService, org.apache.axis2.context.MessageContext)
     */
    @Override
    public AxisOperation findOperation(AxisService service, MessageContext messageContext)
            throws AxisFault {
        AxisOperation theOperation = null;
        if (log.isDebugEnabled()) {
            log.debug("findOperation service = " + service + "; messagectx: " + messageContext);
        }
        
        // If there's an AxisService, then look for the specially named operation and return it
        if (service != null) {
            theOperation = service.getOperation(new QName(EndpointInterfaceDescription.JAXWS_NOWSDL_PROVIDER_OPERATION_NAME));
            if (log.isDebugEnabled()) {
                log.debug("operation " + EndpointInterfaceDescription.JAXWS_NOWSDL_PROVIDER_OPERATION_NAME + " is " + theOperation );
            }
        }
        
        return theOperation;
    }

    /* (non-Javadoc)
     * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
     */
    @Override
    public AxisService findService(MessageContext messageContext) throws AxisFault {
        // This dispatcher will not try to resolve and AxisService if one hasn't been
        // resolved already
        return null;
    }

    /* (non-Javadoc)
     * @see org.apache.axis2.engine.AbstractDispatcher#initDispatcher()
     */
    @Override
    public void initDispatcher() {
        // No initialization necessary
    }

}

Other Axis 2 examples (source code examples)

Here is a short list of links related to this Axis 2 GenericProviderDispatcher.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.