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

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

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 Service1_Service_Impl extends com.nec.webotx.webservice.xml.rpc.client.BasicService implements Service1_Service {
    private static final QName serviceName = new QName("http://sample/WebOTX", "Service1");
    private static final QName ns1_Service1Port_QNAME = new QName("http://sample/WebOTX", "Service1Port");
    private static final Class service1_PortType_PortClass = com.nec.webotx.webservice.director.service1.Service1_PortType.class;
    
    public Service1_Service_Impl() {
        super(serviceName, new QName[] {
                        ns1_Service1Port_QNAME
                    },
            new com.nec.webotx.webservice.director.service1.Service1_Service_SerializerRegistry().getRegistry());
        
    }
    
    public java.rmi.Remote getPort(QName portName, Class serviceDefInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (portName.equals(ns1_Service1Port_QNAME) &&
                serviceDefInterface.equals(service1_PortType_PortClass)) {
                return getService1Port();
            }
        } 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(service1_PortType_PortClass)) {
                return getService1Port();
            }
        } catch (Exception e) {
            throw new ServiceExceptionImpl(new LocalizableExceptionAdapter(e));
        }
        return super.getPort(serviceDefInterface);
    }
    
    public com.nec.webotx.webservice.director.service1.Service1_PortType getService1Port() {
        String[] roles = new String[] {};
        HandlerChainImpl handlerChain = new HandlerChainImpl(getHandlerRegistry().getHandlerChain(ns1_Service1Port_QNAME));
        handlerChain.setRoles(roles);
        com.nec.webotx.webservice.director.service1.Service1_PortType_Stub stub = new com.nec.webotx.webservice.director.service1.Service1_PortType_Stub(handlerChain);
        try {
            stub._initialize(super.internalTypeRegistry);
        } catch (JAXRPCException e) {
            throw e;
        } catch (Exception e) {
            throw new JAXRPCException(e.getMessage(), e);
        }
        return stub;
    }
}
