use of com.AddressDoctor.validator2.addInteractive.Interactive.AddInteractiveResponse in project tdi-studio-se by Talend.
the class AddressDoctorClient method formatAndValidate.
/**
* This is new API, let user to define a structured data "Address" to transmit to the server
*
* @see: bug:6025
* @param args
* @throws Exception
*/
public static AddInteractiveResponse formatAndValidate(Long userId, String password, Address address, CountryOfOriginType originCountry, CountryType countryType, LineSeparatorType lineSeparator, CapitalizationType capitalize) throws Exception {
try {
// Parameter to set in component
// String webServiceURI (should always be
// http://validator2.addressdoctor.com/addInteractive/Interactive.asmx) -> no parameter for this
InteractiveSoap interactiveSoap = (new com.AddressDoctor.validator2.addInteractive.Interactive.InteractiveLocator()).getInteractiveSoap();
AddInteractiveRequest addInteractiveRequest = new AddInteractiveRequest();
Parameters parameters = new Parameters();
addInteractiveRequest.setAddress(address);
// Advanced Parameter Settings
parameters.setCountryOfOrigin(originCountry);
parameters.setCountryType(countryType);
parameters.setLineSeparator(lineSeparator);
parameters.setCapitalization(capitalize);
parameters.setPreferredLanguage(PreferredLanguageType.PFL_PRIMARY);
addInteractiveRequest.setParameters(parameters);
// web service call
addInteractiveRequest.setAuthentication(new Authentication(userId, 0, password));
AddInteractiveResponse resp = interactiveSoap.validate(addInteractiveRequest);
return resp;
} catch (ServiceException e) {
throw e;
} catch (RemoteException e) {
throw e;
}
}
use of com.AddressDoctor.validator2.addInteractive.Interactive.AddInteractiveResponse in project tdi-studio-se by Talend.
the class AddressDoctorClient method formatAndValidate.
/**
* This is old API, via "DeliveryAddressLines" to transmit the input data to the server
*
* @see: bug:6025
* @param args
* @throws Exception
*/
public static Result[] formatAndValidate(Long userId, String password, String addressLines, CountryOfOriginType originCountry, CountryType countryType, LineSeparatorType lineSeparator, CapitalizationType capitalize) throws Exception {
try {
// Parameter to set in component
// String webServiceURI (should always be
// http://validator2.addressdoctor.com/addInteractive/Interactive.asmx) -> no parameter for this
InteractiveSoap interactiveSoap = (new com.AddressDoctor.validator2.addInteractive.Interactive.InteractiveLocator()).getInteractiveSoap();
AddInteractiveRequest addInteractiveRequest = new AddInteractiveRequest();
Parameters parameters = new Parameters();
Address address = new Address();
// set address with input row fixed schema
address.setDeliveryAddressLines(addressLines);
addInteractiveRequest.setAddress(address);
// Advanced Parameter Settings
parameters.setCountryOfOrigin(originCountry);
parameters.setCountryType(countryType);
parameters.setLineSeparator(lineSeparator);
parameters.setCapitalization(capitalize);
parameters.setPreferredLanguage(PreferredLanguageType.PFL_PRIMARY);
addInteractiveRequest.setParameters(parameters);
// web service call
addInteractiveRequest.setAuthentication(new Authentication(userId, 0, password));
AddInteractiveResponse resp = interactiveSoap.validate(addInteractiveRequest);
Result[] results = resp.getResults();
if (resp.getResultCount() > 0) {
return results;
} else {
throw new Exception(resp.getErrorCode() + ":" + resp.getErrorMessage() + ":" + resp.getValidationStatus());
}
} catch (ServiceException e) {
throw e;
} catch (RemoteException e) {
throw e;
}
}
Aggregations