package com.shulead.datasync.portalprice;

import org.apache.axis.AxisFault;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.client.Service;
import org.apache.axis.client.Stub;

import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.Remote;
import java.util.HashSet;
import java.util.Iterator;

/**
 * @Classname PortalPriceLocator
 * @Description TODO
 * @Version 1.0.0
 * @Date 2024/4/28 18:42
 * @Created by liuxiangshun
 */
public class PortalPriceLocator extends Service implements PortalPrice {
//    private String PortalPriceWSImplPort_address = "http://123.59.147.57:18024/cos-webservice/webservice/PortalPrice";
    private String PortalPriceWSImplPort_address = "http://10.42.122.194:9008/cos-webservice-web/webservice/PortalPrice";
    private String PortalPriceWSImplPortWSDDServiceName = "PortalPriceWSImplPort";
    private HashSet ports = null;

    public PortalPriceLocator() {
    }

    public PortalPriceLocator(EngineConfiguration config) {
        super(config);
    }

    public PortalPriceLocator(String wsdlLoc, QName sName) throws ServiceException {
        super(wsdlLoc, sName);
    }

    public String getPortalPriceWSImplPortAddress() {
        return this.PortalPriceWSImplPort_address;
    }

    public String getPortalPriceWSImplPortWSDDServiceName() {
        return this.PortalPriceWSImplPortWSDDServiceName;
    }

    public void setPortalPriceWSImplPortWSDDServiceName(String name) {
        this.PortalPriceWSImplPortWSDDServiceName = name;
    }

    public PortalPriceWS getPortalPriceWSImplPort() throws ServiceException {
        URL endpoint;
        try {
            endpoint = new URL(this.PortalPriceWSImplPort_address);
        } catch (MalformedURLException var3) {
            MalformedURLException e = var3;
            throw new ServiceException(e);
        }

        return this.getPortalPriceWSImplPort(endpoint);
    }

    public PortalPriceWS getPortalPriceWSImplPort(URL portAddress) throws ServiceException {
        try {
            PortalPriceSoapBindingStub _stub = new PortalPriceSoapBindingStub(portAddress, this);
            _stub.setPortName(this.getPortalPriceWSImplPortWSDDServiceName());
            return _stub;
        } catch (AxisFault var3) {
            return null;
        }
    }

    public void setPortalPriceWSImplPortEndpointAddress(String address) {
        this.PortalPriceWSImplPort_address = address;
    }

    public Remote getPort(Class serviceEndpointInterface) throws ServiceException {
        try {
            if (PortalPriceWS.class.isAssignableFrom(serviceEndpointInterface)) {
                PortalPriceSoapBindingStub _stub = new PortalPriceSoapBindingStub(new URL(this.PortalPriceWSImplPort_address), this);
                _stub.setPortName(this.getPortalPriceWSImplPortWSDDServiceName());
                return _stub;
            }
        } catch (Throwable var3) {
            Throwable t = var3;
            throw new ServiceException(t);
        }

        throw new ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }

    public Remote getPort(QName portName, Class serviceEndpointInterface) throws ServiceException {
        if (portName == null) {
            return this.getPort(serviceEndpointInterface);
        } else {
            String inputPortName = portName.getLocalPart();
            if ("PortalPriceWSImplPort".equals(inputPortName)) {
                return this.getPortalPriceWSImplPort();
            } else {
                Remote _stub = this.getPort(serviceEndpointInterface);
                ((Stub)_stub).setPortName(portName);
                return _stub;
            }
        }
    }

    public QName getServiceName() {
        return new QName("http://webservice.promotions.cos.rise.com/", "PortalPrice");
    }

    public Iterator getPorts() {
        if (this.ports == null) {
            this.ports = new HashSet();
            this.ports.add(new QName("http://webservice.promotions.cos.rise.com/", "PortalPriceWSImplPort"));
        }

        return this.ports.iterator();
    }

    public void setEndpointAddress(String portName, String address) throws ServiceException {
        if ("PortalPriceWSImplPort".equals(portName)) {
            this.setPortalPriceWSImplPortEndpointAddress(address);
        } else {
            throw new ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
        }
    }

    public void setEndpointAddress(QName portName, String address) throws ServiceException {
        this.setEndpointAddress(portName.getLocalPart(), address);
    }
}
