use of com.netsuite.webservices.v2014_2.platform.UnexpectedErrorFault in project components by Talend.
the class NetSuitePortTypeMockAdapterImpl method getDataCenterUrls.
public GetDataCenterUrlsResponse getDataCenterUrls(GetDataCenterUrlsRequest parameters) throws InvalidSessionFault, UnexpectedErrorFault, InsufficientPermissionFault, InvalidCredentialsFault, ExceededRequestSizeFault {
GetDataCenterUrlsResponse response = null;
if (port != null) {
response = port.getDataCenterUrls(parameters);
}
if (response == null) {
response = new GetDataCenterUrlsResponse();
GetDataCenterUrlsResult result = new GetDataCenterUrlsResult();
Status status = new Status();
status.setIsSuccess(true);
result.setStatus(status);
DataCenterUrls urls = new DataCenterUrls();
urls.setWebservicesDomain(endpointAddress.toString());
urls.setSystemDomain(endpointAddress.toString());
result.setDataCenterUrls(urls);
response.setGetDataCenterUrlsResult(result);
return response;
}
return response;
}
use of com.netsuite.webservices.v2014_2.platform.UnexpectedErrorFault in project components by Talend.
the class NetSuiteClientServiceImpl method doLogin.
protected void doLogin() throws NetSuiteException {
port = getNetSuitePort(endpointUrl, credentials.getAccount());
setHttpClientPolicy(port);
setLoginHeaders(port);
PortOperation<SessionResponse, NetSuitePortType> loginOp;
if (!credentials.isUseSsoLogin()) {
final Passport passport = createNativePassport(credentials);
loginOp = new PortOperation<SessionResponse, NetSuitePortType>() {
@Override
public SessionResponse execute(NetSuitePortType port) throws Exception {
LoginRequest request = new LoginRequest();
request.setPassport(passport);
LoginResponse response = port.login(request);
return response.getSessionResponse();
}
};
} else {
throw new NetSuiteException(new NetSuiteErrorCode(NetSuiteErrorCode.CLIENT_ERROR), NetSuiteRuntimeI18n.MESSAGES.getMessage("error.ssoLoginNotSupported"));
}
Status status = null;
SessionResponse sessionResponse;
String exceptionMessage = null;
for (int i = 0; i < getRetryCount(); i++) {
try {
sessionResponse = loginOp.execute(port);
status = sessionResponse.getStatus();
} catch (InvalidCredentialsFault f) {
throw new NetSuiteException(new NetSuiteErrorCode(NetSuiteErrorCode.CLIENT_ERROR), f.getFaultInfo().getMessage());
} catch (UnexpectedErrorFault f) {
exceptionMessage = f.getFaultInfo().getMessage();
} catch (Exception e) {
exceptionMessage = e.getMessage();
}
if (status != null) {
break;
}
if (i != getRetryCount() - 1) {
waitForRetryInterval();
}
}
checkLoginError(toNsStatus(status), exceptionMessage);
removeLoginHeaders(port);
}
Aggregations