/**
 * Do not edit.
 *
 * This file was auto-generated
 * by the Web Service Director Eclipse Plugin Edition.
 */

package com.nec.webotx.webservice.sample;

import com.nec.webotx.webservice.xml.rpc.encoding.*;
import com.nec.webotx.webservice.xml.rpc.client.ServiceExceptionImpl;
import com.nec.webotx.webservice.xml.rpc.util.exception.*;
import com.nec.webotx.webservice.xml.rpc.soap.SOAPVersion;
import com.nec.webotx.webservice.xml.rpc.client.HandlerChainImpl;
import javax.xml.rpc.*;
import javax.xml.rpc.encoding.*;
import javax.xml.rpc.handler.HandlerChain;
import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.namespace.QName;

public class Hello_Service_Impl extends com.nec.webotx.webservice.xml.rpc.client.BasicService implements Hello_Service {
    private static final QName serviceName = new QName("http://sample/Hello", "Hello");
    private static final QName ns1_HelloPort_QNAME = new QName("http://sample/Hello", "HelloPort");
    private static final Class hello_PortType_PortClass = com.nec.webotx.webservice.sample.Hello_PortType.class;
    
    public Hello_Service_Impl() {
        super(serviceName, new QName[] {
                        ns1_HelloPort_QNAME
                    },
            new com.nec.webotx.webservice.sample.Hello_Service_SerializerRegistry().getRegistry());
        
    }
    
    public java.rmi.Remote getPort(QName portName, Class serviceDefInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (portName.equals(ns1_HelloPort_QNAME) &&
                serviceDefInterface.equals(hello_PortType_PortClass)) {
                return getHelloPort();
            }
        } catch (Exception e) {
            throw new ServiceExceptionImpl(new LocalizableExceptionAdapter(e));
        }
        return super.getPort(portName, serviceDefInterface);
    }
    
    public java.rmi.Remote getPort(Class serviceDefInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (serviceDefInterface.equals(hello_PortType_PortClass)) {
                return getHelloPort();
            }
        } catch (Exception e) {
            throw new ServiceExceptionImpl(new LocalizableExceptionAdapter(e));
        }
        return super.getPort(serviceDefInterface);
    }
    
    public com.nec.webotx.webservice.sample.Hello_PortType getHelloPort() {
        String[] roles = new String[] {};
        HandlerChainImpl handlerChain = new HandlerChainImpl(getHandlerRegistry().getHandlerChain(ns1_HelloPort_QNAME));
        handlerChain.setRoles(roles);
        com.nec.webotx.webservice.sample.Hello_PortType_Stub stub = new com.nec.webotx.webservice.sample.Hello_PortType_Stub(handlerChain);
        try {
            stub._initialize(super.internalTypeRegistry);
        } catch (JAXRPCException e) {
            throw e;
        } catch (Exception e) {
            throw new JAXRPCException(e.getMessage(), e);
        }
        return stub;
    }
}
