⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 creditcardvalidationservicestub.java

📁 噶额外噶外骨骼感广泛高热感 就 啊啊
💻 JAVA
字号:
package oracle.otnsamples.ws;
import oracle.soap.transport.http.OracleSOAPHTTPConnection;
import org.apache.soap.encoding.SOAPMappingRegistry;
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;
import java.util.ResourceBundle;
/**
 * Generated by the Oracle9i JDeveloper Web Services Stub/Skeleton Generator.
 * Date Created: Thu Jan 30 17:20:27 IST 2003
 * WSDL URL: file:/src/oracle/otnsamples/ws/CCServicesImpl.wsdl
 * 
 * Class providing credit card validation methods. This implementation
 * uses LUHN algorith to validate 16 digit number cards.
 */

public class CreditCardValidationServiceStub {

  public String endpoint = "http://localhost:8888/vsm/CreditCardValidationService";
  private OracleSOAPHTTPConnection httpConnection = null;
  private SOAPMappingRegistry smr = null;

  public CreditCardValidationServiceStub()
  {
    endpoint = ResourceBundle.getBundle("Misc").getString("webservice.endpoint");  
    httpConnection = new OracleSOAPHTTPConnection();
    smr = new SOAPMappingRegistry();
  }


  public void validateCard(String cardNumber) throws Exception
  {
    URL endpointURL = new URL(endpoint);
    Call call = new Call();
    call.setSOAPTransport(httpConnection);
    call.setTargetObjectURI("CreditCardValidationService");
    call.setMethodName("validateCard");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

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

    call.setSOAPMappingRegistry(smr);

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

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

  }

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

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

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

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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -