package oracle.portal.sample.v2.devguide.webservices;
import oracle.soap.transport.http.OracleSOAPHTTPConnection;
import org.apache.soap.encoding.soapenc.BeanSerializer;
import org.apache.soap.encoding.SOAPMappingRegistry;
import org.apache.soap.util.xml.QName;
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: Fri Sep 20 23:53:42 IST 2002
 * WSDL URL: file:/D:/oracle/ora81/Apache/Apache/htdocs/stage/wsdl/otn/9iasmobile.xml
 */

public class OTNMobileWrapperStub
{
  public OTNMobileWrapperStub()
  {
    m_httpConnection = new OracleSOAPHTTPConnection();
    m_smr = new SOAPMappingRegistry();
  }

  public String endpoint = "http://otn.oracle.com/ws/oracle.otn.ws.mobile.OTNMobileWrapper";
  private OracleSOAPHTTPConnection m_httpConnection = null;
  private SOAPMappingRegistry m_smr = null;

  public String[] getStatusesByMsgIDs(String otnUsername, String otnPassword, String[] messageIDs) throws Exception
  {
    String[] returnVal = null;

    URL endpointURL = new URL(endpoint);
    Call call = new Call();
    call.setSOAPTransport(m_httpConnection);
    call.setTargetObjectURI("oracle.otn.ws.mobile.OTNMobileWrapper");
    call.setMethodName("getStatusesByMsgIDs");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

    Vector params = new Vector();
    params.addElement(new Parameter("otnUsername", java.lang.String.class, otnUsername, null));
    params.addElement(new Parameter("otnPassword", java.lang.String.class, otnPassword, null));
    params.addElement(new Parameter("messageIDs", java.lang.String[].class, messageIDs, null));
    call.setParams(params);

    call.setSOAPMappingRegistry(m_smr);

    Response response = call.invoke(endpointURL, "");

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

    return returnVal;
  }

  public String getVersion() throws Exception
  {
    String returnVal = null;

    URL endpointURL = new URL(endpoint);
    Call call = new Call();
    call.setSOAPTransport(m_httpConnection);
    call.setTargetObjectURI("oracle.otn.ws.mobile.OTNMobileWrapper");
    call.setMethodName("getVersion");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

    Vector params = new Vector();
    call.setParams(params);

    call.setSOAPMappingRegistry(m_smr);

    Response response = call.invoke(endpointURL, "");

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

    return returnVal;
  }

  public String[] sendText(String otnUsername, String otnPassword, String[] senders, String[] replyTo, String[] recipients, String[] associatedKeys, String subject, String messageBody, String encoding) throws Exception
  {
    String[] returnVal = null;

    URL endpointURL = new URL(endpoint);
    Call call = new Call();
    call.setSOAPTransport(m_httpConnection);
    call.setTargetObjectURI("oracle.otn.ws.mobile.OTNMobileWrapper");
    call.setMethodName("sendText");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

    Vector params = new Vector();
    params.addElement(new Parameter("otnUsername", java.lang.String.class, otnUsername, null));
    params.addElement(new Parameter("otnPassword", java.lang.String.class, otnPassword, null));
    params.addElement(new Parameter("senders", java.lang.String[].class, senders, null));
    params.addElement(new Parameter("replyTo", java.lang.String[].class, replyTo, null));
    params.addElement(new Parameter("recipients", java.lang.String[].class, recipients, null));
    params.addElement(new Parameter("associatedKeys", java.lang.String[].class, associatedKeys, null));
    params.addElement(new Parameter("subject", java.lang.String.class, subject, null));
    params.addElement(new Parameter("messageBody", java.lang.String.class, messageBody, null));
    params.addElement(new Parameter("encoding", java.lang.String.class, encoding, null));
    call.setParams(params);

    call.setSOAPMappingRegistry(m_smr);

    Response response = call.invoke(endpointURL, "");

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

    return returnVal;
  }

  public String getStatusByMsgID(String otnUsername, String otnPassword, String messageID) throws Exception
  {
    String returnVal = null;

    URL endpointURL = new URL(endpoint);
    Call call = new Call();
    call.setSOAPTransport(m_httpConnection);
    call.setTargetObjectURI("oracle.otn.ws.mobile.OTNMobileWrapper");
    call.setMethodName("getStatusByMsgID");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

    Vector params = new Vector();
    params.addElement(new Parameter("otnUsername", java.lang.String.class, otnUsername, null));
    params.addElement(new Parameter("otnPassword", java.lang.String.class, otnPassword, null));
    params.addElement(new Parameter("messageID", java.lang.String.class, messageID, null));
    call.setParams(params);

    call.setSOAPMappingRegistry(m_smr);

    Response response = call.invoke(endpointURL, "");

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

    return returnVal;
  }

  public String[] getSupportedTransports() throws Exception
  {
    String[] returnVal = null;

    URL endpointURL = new URL(endpoint);
    Call call = new Call();
    call.setSOAPTransport(m_httpConnection);
    call.setTargetObjectURI("oracle.otn.ws.mobile.OTNMobileWrapper");
    call.setMethodName("getSupportedTransports");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

    Vector params = new Vector();
    call.setParams(params);

    call.setSOAPMappingRegistry(m_smr);

    Response response = call.invoke(endpointURL, "");

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

    return returnVal;
  }

  public String[] sendTextMsg(String otnUsername, String otnPassword, String[] senders, String[] recipients, String messageBody) throws Exception
  {
    String[] returnVal = null;

    URL endpointURL = new URL(endpoint);
    Call call = new Call();
    call.setSOAPTransport(m_httpConnection);
    call.setTargetObjectURI("oracle.otn.ws.mobile.OTNMobileWrapper");
    call.setMethodName("sendTextMsg");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

    Vector params = new Vector();
    params.addElement(new Parameter("otnUsername", java.lang.String.class, otnUsername, null));
    params.addElement(new Parameter("otnPassword", java.lang.String.class, otnPassword, null));
    params.addElement(new Parameter("senders", java.lang.String[].class, senders, null));
    params.addElement(new Parameter("recipients", java.lang.String[].class, recipients, null));
    params.addElement(new Parameter("messageBody", java.lang.String.class, messageBody, null));
    call.setParams(params);

    call.setSOAPMappingRegistry(m_smr);

    Response response = call.invoke(endpointURL, "");

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

    return returnVal;
  }

  public String[] sendTextMsgWrapper(String otnUsername, String otnPassword, String senders, String recipients, String messageBody) throws Exception
  {

    String[] returnVal = null;
    String[] from ={senders};
    String[] to = {recipients};

    returnVal = sendTextMsg(otnUsername, otnPassword,from, to,messageBody);
    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();
  }
}
