/**
 * RandomDotOrgLocator.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */

package org.random.www.RandomDotOrg_wsdl;

public class RandomDotOrgLocator extends org.apache.axis.client.Service 
    implements org.random.www.RandomDotOrg_wsdl.RandomDotOrg {

  // Use to get a proxy class for RandomDotOrgPort
  private final java.lang.String RandomDotOrgPort_address = 
    "http://www.random.org/cgi-bin/Random.cgi";

  public java.lang.String getRandomDotOrgPortAddress() {
    return RandomDotOrgPort_address;
  }

  // The WSDD service name defaults to the port name.
  private java.lang.String RandomDotOrgPortWSDDServiceName = 
    "RandomDotOrgPort";

  public java.lang.String getRandomDotOrgPortWSDDServiceName() {
    return RandomDotOrgPortWSDDServiceName;
  }

  public void setRandomDotOrgPortWSDDServiceName(
      java.lang.String name) {
    RandomDotOrgPortWSDDServiceName = name;
  }

  public org.random.www.RandomDotOrg_wsdl.RandomDotOrgPortType 
      getRandomDotOrgPort() throws javax.xml.rpc.ServiceException {
    java.net.URL endpoint;
    try {
      endpoint = new java.net.URL(RandomDotOrgPort_address);
    }
    catch (java.net.MalformedURLException e) {
      throw new javax.xml.rpc.ServiceException(e);
    }
    return getRandomDotOrgPort(endpoint);
  }

  public org.random.www.RandomDotOrg_wsdl.RandomDotOrgPortType 
      getRandomDotOrgPort(java.net.URL portAddress) 
        throws javax.xml.rpc.ServiceException {
    try {
      org.random.www.RandomDotOrg_wsdl.RandomDotOrgBindingStub _stub = 
        new org.random.www.RandomDotOrg_wsdl.RandomDotOrgBindingStub(
          portAddress, this);
      _stub.setPortName(getRandomDotOrgPortWSDDServiceName());
      return _stub;
    }
    catch (org.apache.axis.AxisFault e) {
      return null;
    }
  }

  /**
   * For the given interface, get the stub implementation.
   * If this service has no port for the given interface,
   * then ServiceException is thrown.
   */
  public java.rmi.Remote getPort(Class serviceEndpointInterface) 
      throws javax.xml.rpc.ServiceException {
    try {
      if (org.random.www.RandomDotOrg_wsdl.RandomDotOrgPortType.
          class.isAssignableFrom(serviceEndpointInterface)) {
        org.random.www.RandomDotOrg_wsdl.RandomDotOrgBindingStub _stub =
          new org.random.www.RandomDotOrg_wsdl.RandomDotOrgBindingStub(
            new java.net.URL(RandomDotOrgPort_address), this);
        _stub.setPortName(getRandomDotOrgPortWSDDServiceName());
        return _stub;
      }
    }
    catch (java.lang.Throwable t) {
      throw new javax.xml.rpc.ServiceException(t);
    }
    throw new javax.xml.rpc.ServiceException(
      "There is no stub implementation for the interface:  " + 
        (serviceEndpointInterface == null ? "null" : 
          serviceEndpointInterface.getName()));
  }

  /**
   * For the given interface, get the stub implementation.
   * If this service has no port for the given interface,
   * then ServiceException is thrown.
   */
  public java.rmi.Remote getPort(javax.xml.namespace.QName portName, 
      Class serviceEndpointInterface) 
        throws javax.xml.rpc.ServiceException {
    if (portName == null) {
      return getPort(serviceEndpointInterface);
    }
    String inputPortName = portName.getLocalPart();
    if ("RandomDotOrgPort".equals(inputPortName)) {
      return getRandomDotOrgPort();
    }
    else  {
      java.rmi.Remote _stub = getPort(serviceEndpointInterface);
      ((org.apache.axis.client.Stub) _stub).setPortName(portName);
      return _stub;
    }
  }

  public javax.xml.namespace.QName getServiceName() {
    return new javax.xml.namespace.QName(
      "http://www.random.org/RandomDotOrg.wsdl", "RandomDotOrg");
  }

  private java.util.HashSet ports = null;

  public java.util.Iterator getPorts() {
    if (ports == null) {
      ports = new java.util.HashSet();
      ports.add(new javax.xml.namespace.QName("RandomDotOrgPort"));
    }
    return ports.iterator();
  }
}
