當前位置: 首頁>>代碼示例>>Java>>正文


Java XmlRpcClient.setTransportFactory方法代碼示例

本文整理匯總了Java中org.apache.xmlrpc.client.XmlRpcClient.setTransportFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java XmlRpcClient.setTransportFactory方法的具體用法?Java XmlRpcClient.setTransportFactory怎麽用?Java XmlRpcClient.setTransportFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.xmlrpc.client.XmlRpcClient的用法示例。


在下文中一共展示了XmlRpcClient.setTransportFactory方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeClient

import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
/**
 * Set up the configuration
 * 
 * @return
 * @throws MalformedURLException
 */
private XmlRpcClient initializeClient() {
	// Get the RPC client set up and ready to go
	// The alternate TransportFactory stuff is required so that cookies
	// work and the logins behave persistently
	XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
	try {
		config.setServerURL(new URL(this.getServerURLWithRpc()));
	} catch (MalformedURLException e) {
		e.printStackTrace();
	}

	// config.setEnabledForExtensions(true);
	XmlRpcClient client = new XmlRpcClient();
	client.setConfig(config);
	XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory(client);
	factory.setHttpClient(new HttpClient());
	client.setTransportFactory(factory);

	return client;
}
 
開發者ID:jqxin2006,項目名稱:threadfixRack,代碼行數:27,代碼來源:BugzillaDefectTracker.java

示例2: connect

import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
/**
 * Connect to remote Koji instance. Uses custom Transport factory adding a None / null support for XML-RPC.
 *
 * @param kojiInstanceURL Address of the remote Koji server.
 * @return XMLRPC client instance.
 */
private XmlRpcClient connect(String kojiInstanceURL) throws MalformedURLException {
    XmlRpcClient koji = new XmlRpcClient();
    koji.setTransportFactory(new XmlRpcCommonsTransportFactory(koji));
    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    koji.setTransportFactory(new XmlRpcCommonsTransportFactory(koji));
    koji.setTypeFactory(new MyTypeFactory(koji));
    config.setEnabledForExtensions(true);
    config.setEnabledForExceptions(true);

    try {
        config.setServerURL(new URL(kojiInstanceURL));
    } catch (MalformedURLException e) {
        throw e;
    }

    koji.setConfig(config);

    return koji;
}
 
開發者ID:vtunka,項目名稱:jenkins-koji-plugin,代碼行數:26,代碼來源:KojiClient.java

示例3: makeCall

import org.apache.xmlrpc.client.XmlRpcClient; //導入方法依賴的package包/類
private PaymentAuthorizationDTO makeCall(Map<String, Object> data,
        boolean isCharge) throws XmlRpcException, MalformedURLException,
        PluggableTaskException {

    URL callURL = null;
    if ("true".equals(getOptionalParameter(PARAMETER_TEST.getName(), "false"))) {
        callURL = new URL(TEST_URL);
        log.debug("Running Atlas task in test mode!");
    } else {
        callURL = new URL(URL);
    }
    String merchantAccountCode = ensureGetParameter(PARAMETER_MERCHANT_ACCOUNT_CODE.getName());

    int merchantCode = Integer.parseInt(merchantAccountCode);
    merchantCode = merchantCode - (merchantCode % 1000);

    XmlRpcClient paymentProcessor = new XmlRpcClient();
    paymentProcessor.setTransportFactory(new XmlRpcCommonsTransportFactory(
            paymentProcessor));

    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    config.setServerURL(callURL);
    config.setEnabledForExtensions(true);
    config.setConnectionTimeout(CONNECTION_TIME_OUT);
    config.setReplyTimeout(REPLY_TIME_OUT);

    paymentProcessor.setConfig(config);

    List<Map<String, Object>> transactionRequestList = new ArrayList<Map<String, Object>>(
            1);
    transactionRequestList.add(data);

    Map<String, Object> configParam = new HashMap<String, Object>();
    if (isCharge) {
        configParam.put("waitConfirmation", "ignore");
    } else {
        configParam.put("waitConfirmation", "terminate");
    }

    Object[] params = new Object[] { String.valueOf(merchantCode),
            ensureGetParameter(PARAMETER_PASSWORD.getName()), transactionRequestList,
            configParam };

    Object[] resresponse = (Object[]) paymentProcessor.execute(
            "XMLRPCGates.processRetail", params);

    Map<String, Object> transactionResponseMap = (Map<String, Object>) resresponse[0];

    log.debug("Got response:" + transactionResponseMap);

    boolean isCredit = "credit-response".equals(transactionResponseMap
            .get("type"));

    PaymentAuthorizationDTO dbRow = new PaymentAuthorizationDTO();
    if (!isCredit
            && "A01".equals(transactionResponseMap.get("responseCode"))) {
        dbRow.setCode1("1"); // code if 1 it is ok
    } else if (isCredit
            && "A02".equals(transactionResponseMap.get("responseCode"))) {
        dbRow.setCode1("1");
    } else if ('A' != ((String) transactionResponseMap.get("responseCode"))
            .charAt(0)) {
        dbRow.setCode1("2");
    } else {
        dbRow.setCode1("0");
    }
    dbRow.setCode3((String) transactionResponseMap.get("responseCode"));
    dbRow.setResponseMessage((String) transactionResponseMap
            .get("responseMessage"));
    dbRow.setApprovalCode((String) transactionResponseMap
            .get("processorCode"));
    dbRow.setAvs((String) transactionResponseMap.get("avsResultCode"));
    dbRow.setTransactionId((String) transactionResponseMap
            .get("referenceNumber"));
    dbRow.setProcessor("Intrannuity");
    return dbRow;
}
 
開發者ID:maxdelo77,項目名稱:replyit-master-3.2-final,代碼行數:78,代碼來源:PaymentAtlasTask.java


注:本文中的org.apache.xmlrpc.client.XmlRpcClient.setTransportFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。