AddAddress

This call adds new addresses to existing employee records in PureSafety. Addresses added through this method are created as "Business" type addresses. You can indicate if the new address should become the primary address.

Information Employee Web Service 1 Employee Web Service 2

Syntax

AddAddress(UserLoginWebServiceEntity userLoginWebServiceEntity, string employeeCode, string address1, string address2, string city, string country, bool isPrimary)

AddAddress(UserLoginWebServiceEntity userLoginWebServiceEntity, string employeeCode, string address1, string address2, string city, string state, string zip, string zip4, string country, bool isPrimary)

Fields

Required Fields

  • WebServiceLoginName
  • WebServiceLoginPassword
  • EmployeeCode
  • Address1
  • Address2
  • City
  • Country
  • IsPrimary
  • WebServiceLoginName
  • WebServiceLoginPassword
  • EmployeeCode
  • Address1
  • Address2
  • City
  • Country
  • IsPrimary
  • State
  • Zip
  • Zip4

Response

  • True if successful
  • False if there were errors
  • True if successful
  • False if there were errors

Sample Code - C# (Employee Web Service 1)

public void Sample()
{
    UserLoginWebServiceEntity userLoginWebServiceEntity = new UserLoginWebServiceEntity();
        
    userLoginWebServiceEntity.WebServiceLoginName = "username";
	userLoginWebServiceEntity.WebServiceLoginPassword = "password";
    
	string employeeCode = "JB01";
	string address1 = "1234 Straight Rd.";
	string address2 = "Apt 1";
	string city = "SmallTown";
	string country = "USA";
	bool isPrimary = true;
    
    // Invoke the call  
    
    try
    {
		EmployeeWebServiceContractClient employeeWebService = new EmployeeWebServiceContractClient();
        employeeWebService.AddAddress(userLoginWebServiceEntity, employeeCode, address1,address2, city, country, isPrimary);
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
} 

Sample Code - C# (Employee Web Service Service 2)

	public void CSharpSample() {
			UserLoginWebServiceEntity userLoginWebServiceEntity = new UserLoginWebServiceEntity() {
					WebServiceLoginName = "username",
					WebServiceLoginPassword = "password"
			};
			try {
				EmployeeWebServiceContractClient employeeWebService = new EmployeeWebServiceContractClient();
				// Invoke the call
				if (!employeeWebService.AddAddress(
						userLoginWebServiceEntity, 
						"JB01",
						"1234 Straight Rd.",
						"Apt 1",
						"SmallTown",
						"TX",			//NEW for v2
						"55555",		//NEW for v2
						"1111",			//NEW for v2
						"USA",
						true)
					)
					throw new Exception("Method call was not successful.");
			} catch (FaultException<PureSafetyFaultDetail> detail) {
				Console.WriteLine(String.Format("ErrorCode: {0}, ErrorDescription: {1}", detail.Detail.ErrorCode, detail.Detail.ErrorDescription));
			} catch (Exception ex) {
				Console.WriteLine(ex.Message);
			}
		}

Sample Code - Java (Employee Web Service Service 1)

public void JavaSample()
{
UserLoginWebServiceEntity userLoginWebServiceEntity = 
new UserLoginWebServiceEntity("username","password");

String employeeCode = "JB01";
String address1 = "1234 Straight Rd.";
String address2 = "Apt 1";
String city = "SmallTown";
String country = "USA";
boolean isPrimary = true;

try { //Invoke the call
      EmployeeWebServiceLocator locator = new EmployeeWebServiceLocator();
      EmployeeWebServiceContract employeeWebService = locator.getbasicEndpoint();
      employeeWebService.addAddress(
		userLoginWebServiceEntity,
		employeeCode,
		address1,
		address2,
		city,
		country,
		isPrimary
	);
}
catch (Exception e) {
e.printStackTrace();
}
}

Sample Code - Java (Employee Web Service Service 2)

public void JavaExample() {
		UserLoginWebServiceEntity userLoginWebServiceEntity = new UserLoginWebServiceEntity (
				"username",
				"password"
		);
		try { //Invoke the call
			EmployeeWebServiceLocator locator = new EmployeeWebServiceLocator();
			EmployeeWebServiceContract employeeWebService = locator.getbasicEndpoint();
			if (!employeeWebService.addAddress(
						userLoginWebServiceEntity, 
						"JB01",
						"1234 Straight Rd.",
						"Apt 1",
						"SmallTown",
						"TX",			//NEW for v2
						"55555",		//NEW for v2
						"1111",			//NEW for v2
						"USA",
						true)
				)
				throw new Exception("Method call was not successful.");
		} catch (PureSafetyFaultDetail detail) {				
			System.out.println(String.format("ErrorCode: %s, ErrorDescription: %s", detail.getErrorCode(), detail.getErrorDescription()));
		} catch (Exception ex) {
			System.out.println(ex.getMessage());
		}
	}