本文整理汇总了Java中org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory类的典型用法代码示例。如果您正苦于以下问题:Java XmlRpcCommonsTransportFactory类的具体用法?Java XmlRpcCommonsTransportFactory怎么用?Java XmlRpcCommonsTransportFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlRpcCommonsTransportFactory类属于org.apache.xmlrpc.client包,在下文中一共展示了XmlRpcCommonsTransportFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CookieAwareXmlRpcClient
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory; //导入依赖的package包/类
public CookieAwareXmlRpcClient(String url) {
super();
try {
this.apiURL = new URL(url);
} catch (MalformedURLException e) {
throw new RuntimeIOException(e);
}
String homeFolder = System.getProperty("user.home");
cookieFileStore = new CookieFileStore(homeFolder);
workflowCertificateManager = new WorkflowCertificateManager(homeFolder + "/.workflowTool.keystore");
final XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(apiURL);
final XmlRpcCommonsTransportFactory factory = new XmlRpcCookiesTransportFactory(this, cookieFileStore);
this.setTransportFactory(factory);
this.setTypeFactory(new TolerantTypeFactory(this));
this.setConfig(config);
}
示例2: initializeClient
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory; //导入依赖的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;
}
示例3: Confluence
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory; //导入依赖的package包/类
protected Confluence(String endpoint, ConfluenceProxy proxyInfo ) throws URISyntaxException, MalformedURLException {
this(new XmlRpcClient());
if (endpoint.endsWith("/")) {
endpoint = endpoint.substring(0, endpoint.length() - 1);
}
endpoint = ConfluenceService.Protocol.XMLRPC.addTo(endpoint);
final java.net.URI serviceURI = new java.net.URI(endpoint);
XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl();
clientConfig.setServerURL(serviceURI.toURL() );
clientConfig.setEnabledForExtensions(true); // add this to support attachment upload
client.setConfig( clientConfig );
if( isProxyEnabled(proxyInfo, serviceURI) ) {
final XmlRpcCommonsTransportFactory transportFactory = new XmlRpcCommonsTransportFactory( client );
final HttpClient httpClient = new HttpClient();
final HostConfiguration hostConfiguration = httpClient.getHostConfiguration();
hostConfiguration.setProxy( proxyInfo.host, proxyInfo.port );
hostConfiguration.setHost(serviceURI.getHost(), serviceURI.getPort(), serviceURI.toURL().getProtocol());
if( !isNullOrEmpty(proxyInfo.userName) && !isNullOrEmpty(proxyInfo.password) ) {
Credentials cred = new UsernamePasswordCredentials(proxyInfo.userName,proxyInfo.password);
httpClient.getState().setProxyCredentials(AuthScope.ANY, cred);
}
transportFactory.setHttpClient( httpClient );
client.setTransportFactory( transportFactory );
}
}
示例4: connect
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory; //导入依赖的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;
}
示例5: setDebug
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory; //导入依赖的package包/类
public void setDebug(boolean debug) {
if (debug)
koji.setTransportFactory(new MyXmlRpcCommonsTransportFactory(koji));
else
koji.setTransportFactory(new XmlRpcCommonsTransportFactory(koji));
}
示例6: makeCall
import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory; //导入依赖的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;
}