what-the-bank/sources/com/kofax/kmc/klo/logistics/webservice/calls/KofaxWebServiceCallBase.java

220 lines
7.2 KiB
Java

package com.kofax.kmc.klo.logistics.webservice.calls;
import com.kofax.kmc.klo.logistics.service.NetworkService;
import com.kofax.kmc.klo.logistics.webservice.KofaxWebServiceResponseBase;
import com.kofax.kmc.klo.logistics.webservice.WebServiceCallResult;
import com.kofax.kmc.kut.utilities.AppContextProvider;
import com.kofax.kmc.kut.utilities.CertificateValidatorListener;
import com.kofax.mobile.sdk._internal.k;
import com.kofax.mobile.sdk.ak.d;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import o.C15280gmP;
import o.C15281gmQ;
import o.C15332gnh;
import o.gmO;
import o.gmY;
/* loaded from: classes3.dex */
public abstract class KofaxWebServiceCallBase {
private static final String TAG = "KofaxWebServiceCallBase";
private CertificateValidatorListener certificateValidatorListener;
private String kmsHostPort;
protected int timeout = 20000;
private String kfsHostPort = "";
private String kfsServerType = "";
protected String kfsUsername = "";
protected String kfsPassword = "";
public abstract String getMethodName();
public abstract String getNamespace();
public abstract String getServiceName();
public abstract String getSoapAction();
protected abstract gmO packageRequest();
public abstract KofaxWebServiceResponseBase populateFromResponse(gmO gmo);
public void registerMarshallers(C15280gmP c15280gmP) {
}
public WebServiceCallResult init(URL url, CertificateValidatorListener certificateValidatorListener) {
this.certificateValidatorListener = certificateValidatorListener;
WebServiceCallResult webServiceCallResult = new WebServiceCallResult();
webServiceCallResult.setSuccess(false);
if (!initHosts(url)) {
webServiceCallResult.setErrorMsg("Unable to init connector info");
return webServiceCallResult;
}
webServiceCallResult.setSuccess(true);
return webServiceCallResult;
}
private boolean initHosts(URL url) {
String obj = url.toString();
this.kfsHostPort = obj;
this.kmsHostPort = obj;
return true;
}
public List<String> getParamNames() {
return new ArrayList();
}
public List<Object> getParamValues() {
return new ArrayList();
}
public String getServiceCall() {
StringBuilder sb = new StringBuilder();
sb.append(this.kmsHostPort);
sb.append(getServiceName());
return sb.toString();
}
protected List<C15332gnh> getExtraHeaders() {
return new ArrayList();
}
public void setKfsHostPort(URL url) {
this.kfsHostPort = url.toString();
}
public KofaxWebServiceResponseBase execute() throws Exception {
if (NetworkService.getMacAddress() == null && !NetworkService.initializeNetworkSettings(AppContextProvider.getContext())) {
throw new RuntimeException("Network is unreachable");
}
C15280gmP c15280gmP = new C15280gmP();
c15280gmP.f = true;
registerMarshallers(c15280gmP);
c15280gmP.b(packageRequest());
C15332gnh b = new C15332gnh().b(getNamespace(), "KfsBaseUrl");
String str = this.kfsHostPort;
Vector vector = b.a;
b.a(vector == null ? 0 : vector.size(), 4, str);
ArrayList arrayList = new ArrayList();
arrayList.add(b);
Iterator<C15332gnh> it = getExtraHeaders().iterator();
while (it.hasNext()) {
arrayList.add(it.next());
}
C15332gnh[] c15332gnhArr = new C15332gnh[arrayList.size()];
for (int i = 0; i < arrayList.size(); i++) {
c15332gnhArr[i] = (C15332gnh) arrayList.get(i);
}
c15280gmP.d = c15332gnhArr;
String str2 = TAG;
StringBuilder sb = new StringBuilder("nameSpace -> ");
sb.append(getNamespace());
k.b(str2, sb.toString());
StringBuilder sb2 = new StringBuilder("methodName -> ");
sb2.append(getMethodName());
k.b(str2, sb2.toString());
StringBuilder sb3 = new StringBuilder("serviceUrl -> ");
sb3.append(getServiceCall());
k.b(str2, sb3.toString());
StringBuilder sb4 = new StringBuilder("soapAction -> ");
sb4.append(getSoapAction());
k.b(str2, sb4.toString());
gmY a = d.a(getServiceCall(), this.timeout, this.certificateValidatorListener);
try {
try {
c15280gmP.j = true;
a.e(getSoapAction(), c15280gmP);
return populateFromResponse((gmO) c15280gmP.a());
} catch (Exception e) {
throw e;
}
} finally {
String[] split = getClass().toString().split("\\.");
if (split.length > 0) {
String str3 = split[split.length - 1];
}
}
}
private void dumpStringToFile(String str, String str2) {
try {
String str3 = new String("/sdcard/WscDump_");
StringBuilder sb = new StringBuilder();
sb.append(str3);
sb.append(str2);
sb.append(".xml");
File file = new File(sb.toString());
file.createNewFile();
FileOutputStream fileOutputStream = new FileOutputStream(file);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream);
outputStreamWriter.append((CharSequence) str);
outputStreamWriter.close();
fileOutputStream.close();
} catch (Exception e) {
k.e("dumpStringToFile", "error writing string to file", (Throwable) e);
}
}
private void dumpStringToLog(String str, String str2, String str3) {
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(str2);
String obj = sb.toString();
StringBuilder sb2 = new StringBuilder();
sb2.append(str3);
sb2.append("_");
sb2.append(str.replace(" ->", ""));
dumpStringToFile(str2, sb2.toString());
while (obj.length() > 1024) {
k.b(TAG, obj.substring(0, 1024));
obj = obj.substring(1024);
}
if (obj.length() > 0) {
k.b(TAG, obj);
}
}
public C15281gmQ createPropertyInfo(String str, String str2, Object obj, Class cls) {
C15281gmQ c15281gmQ = new C15281gmQ();
c15281gmQ.m = str2;
c15281gmQ.l = str;
c15281gmQ.a(obj);
c15281gmQ.k = cls;
return c15281gmQ;
}
public void setkfsUsername(String str) {
this.kfsUsername = str;
}
public void setkfsPassword(String str) {
this.kfsPassword = str;
}
public void setTimeout(int i) {
this.timeout = i;
}
public void setCertificateValidatorListener(CertificateValidatorListener certificateValidatorListener) {
this.certificateValidatorListener = certificateValidatorListener;
}
public String getkfsServerType() {
return this.kfsServerType;
}
public int getTimeout() {
return this.timeout;
}
public CertificateValidatorListener getCertificateValidatorListener() {
return this.certificateValidatorListener;
}
}