package oracle.portal.sample.v2.devguide.webservices;
import oracle.soap.transport.http.OracleSOAPHTTPConnection;
import java.net.URL;
import org.apache.soap.Constants;
import org.apache.soap.Fault;
import org.apache.soap.SOAPException;
import org.apache.soap.rpc.Call;
import org.apache.soap.rpc.Parameter;
import org.apache.soap.rpc.Response;
import java.util.Vector;
import java.util.Properties;
/**
 * Generated by the Oracle9i JDeveloper Web Services Stub/Skeleton Generator.
 * Date Created: Mon Mar 11 14:39:20 GMT 2002
 * net.xmethods.services.stockquote.StockQuote web service
 */

public class NetXmethodsServicesStockquoteStockQuoteServiceStub 
{
  public String endpoint = "http://66.28.98.121:9090/soap";
  private OracleSOAPHTTPConnection m_httpConnection = null;

  public NetXmethodsServicesStockquoteStockQuoteServiceStub()
  {
    m_httpConnection = new OracleSOAPHTTPConnection();
  }

  public Float getQuote(String symbol) throws Exception
  {
    Float returnVal = null;

    URL endpointURL = new URL(endpoint);
    Call call = new Call();
    call.setSOAPTransport(m_httpConnection);
    call.setTargetObjectURI("urn:xmethods-delayed-quotes");
    call.setMethodName("getQuote");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
    Vector params = new Vector();
    params.addElement(new Parameter("symbol", String.class, symbol, null));
    call.setParams(params);

    Response response = call.invoke(endpointURL, "urn:xmethods-delayed-quotes#getQuote");

    if (!response.generatedFault())
    {
      Parameter result = response.getReturnValue();
      returnVal = (Float)result.getValue();
    }
      else
      {
        Fault fault = response.getFault();
        throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
      }

    return returnVal;
  }

  public void setMaintainSession(boolean maintainSession)
  {
    m_httpConnection.setMaintainSession(maintainSession);
  }

  public boolean getMaintainSession()
  {
    return m_httpConnection.getMaintainSession();
  }

  public void setTransportProperties(Properties props)
  {
    m_httpConnection.setProperties(props);
  }

  public Properties getTransportProperties()
  {
    return m_httpConnection.getProperties();
  }
}