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

package com.nec.webotx.webservice.director.service2;

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 Service2_Service_Impl extends com.nec.webotx.webservice.xml.rpc.client.BasicService implements Service2_Service {
    private static final QName serviceName = new QName("http://sample/WebOTX", "Service2");
    private static final QName ns1_Service2Port_QNAME = new QName("http://sample/WebOTX", "Service2Port");
    private static final Class service2_PortType_PortClass = com.nec.webotx.webservice.director.service2.Service2_PortType.class;
    
    public Service2_Service_Impl() {
        super(serviceName, new QName[] {
                        ns1_Service2Port_QNAME
                    },
            new com.nec.webotx.webservice.director.service2.Service2_Service_SerializerRegistry().getRegistry());
        
    }
    
    public java.rmi.Remote getPort(QName portName, Class serviceDefInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (portName.equals(ns1_Service2Port_QNAME) &&
                serviceDefInterface.equals(service2_PortType_PortClass)) {
                return getService2Port();
            }
        } 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(service2_PortType_PortClass)) {
                return getService2Port();
            }
        } catch (Exception e) {
            throw new ServiceExceptionImpl(new LocalizableExceptionAdapter(e));
        }
        return super.getPort(serviceDefInterface);
    }
    
    public com.nec.webotx.webservice.director.service2.Service2_PortType getService2Port() {
        String[] roles = new String[] {};
        HandlerChainImpl handlerChain = new HandlerChainImpl(getHandlerRegistry().getHandlerChain(ns1_Service2Port_QNAME));
        handlerChain.setRoles(roles);
        com.nec.webotx.webservice.director.service2.Service2_PortType_Stub stub = new com.nec.webotx.webservice.director.service2.Service2_PortType_Stub(handlerChain);
        try {
            stub._initialize(super.internalTypeRegistry);
        } catch (JAXRPCException e) {
            throw e;
        } catch (Exception e) {
            throw new JAXRPCException(e.getMessage(), e);
        }
        return stub;
    }
}
