...
Include and reference these files in your application and you will be able to make calls to the Web Services. Some examples are given below.
Java Code Examples
It is important to enclose your web service calls in try / catch blocks as Exceptions are used as the mechanism for feeding back any issues. For example if you attempt to create a placement without providing an External ID, an exception will be returned from the Web Service call.
Authenticate
try { //Create an instance of the stub IntimeServiceV2_0Stub stub = new IntimeServiceV2_0Stub("https://demo.in-time.co.uk/services/IntimeServiceV2_0?wsdl"); //Get an authentication token IntimeServiceV2_0Stub.Authenticate auth=new IntimeServiceV2_0Stub.Authenticate(); auth.setAgencyRefCode("<supplied_credentials>"); auth.setUsername("<supplied_credentials>"); auth.setPassword("<supplied_credentials>"); IntimeServiceV2_0Stub.AuthenticateResponse authResp=stub.authenticate(auth); String ticket=authResp.get_return(); System.out.println("Authentication token:" + ticket); //Use this authentication token (ticket) to pass in to any of the other WebService calls } catch (java.lang.Exception e) { System.out.println("Exception occurred: " + e); } |
---|
...
try { IntimeServiceV2_0Stub.Worker worker = new IntimeServiceV2_0Stub.Worker(); worker.setExternalId("WKR_LTD_001"); worker.setFirstname("Ltd"); worker.setLastname("Worker"); worker.setEmail("x@xx@x.com"); worker.setTitle("Mrs"); worker.setWorkerType("ltd"); worker.setGender("F"); worker.setSelfBilling(false); worker.setAccountsReference("ACC_REF"); worker.setPaymentFrequency("Monthly"); String[] wConsolidation = new String[] { "destination","source","pay-currency","purchase-tax-code","worker","placement" }; worker.setConsolidation(wConsolidation); String[] wCrouping = new String[] { "sheet","sheet-rate" }; worker.setGrouping(wCrouping); Calendar cal = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT")); cal.set(1980, 0, 1, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); worker.setDateOfBirth(cal); Calendar cal2 = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT")); cal2.set(2017, 0, 1, 0, 0, 0); cal2.set(Calendar.MILLISECOND, 0); worker.setDateOfJoining(cal2); IntimeServiceV2_0Stub.Address address = new IntimeServiceV2_0Stub.Address(); address.setLine1("Address1"); address.setLine2("Add2"); address.setTown("Town"); address.setCounty("County"); address.setCountry("UK"); address.setPostcode("AB1 2CD"); address.setCountryCode("GB"); worker.setAddress(address); BankAccount bank = new BankAccount(); bank.setAccountName("Ltd Wkr"); bank.setAccountNumber("12345678"); bank.setBank("bank"); bank.setSortCode("11-22-33"); worker.setBankAccount(bank); Company ltdCompany = new Company(); ltdCompany.setName("Ltd Co Name"); ltdCompany.setCompanyNo("123456789"); ltdCompany.setCompanyVatNo("1234567890"); ltdCompany.setVatCode("T0"); worker.setLimitedCompany(ltdCompany); IntimeServiceV2_0Stub.CreateOrUpdateWorker request = new IntimeServiceV2_0Stub.CreateOrUpdateWorker(); request.setToken(ticket); request.setWorker(worker); IntimeServiceV2_0Stub.CreateOrUpdateWorkerResponse result=stub.createOrUpdateWorker(request); if (result != null) { System.out.println("Created/updated Worker with ID:" + result.get_return()); } } catch (java.lang.Exception e) { System.out.println("Exception occurred: " + e); } |
---|
...
try{ IntimeServiceV2_0Stub.Placement placement = new IntimeServiceV2_0Stub.Placement(); //referencing existing participants by External Id IntimeServiceV2_0Stub.Worker worker = new IntimeServiceV2_0Stub.Worker(); worker.setExternalId("WKR_001"); placement.setWorker(worker); IntimeServiceV2_0Stub.Consultant consultant = new IntimeServiceV2_0Stub.Consultant(); consultant.setExternalId("CONS_001"); placement.setConsultant(consultant); IntimeServiceV2_0Stub.Client client = new IntimeServiceV2_0Stub.Client(); client.setExternalId("CLIENT_001"); placement.setClient(client); IntimeServiceV2_0Stub.Manager manager = new IntimeServiceV2_0Stub.Manager(); manager.setExternalId("MGR_001"); placement.setManager(manager); placement.setExternalId("WEB-PLC-001"); placement.setContractedHours(new BigDecimal(37.5)); placement.setCurrencyForCharge("GBP"); placement.setCurrencyForPayExpenses("GBP"); placement.setCurrencyForPayTimesheets("GBP"); placement.setChargeableExpenseApprovalRoute("Client Manager Approval"); placement.setNonChargeableExpenseApprovalRoute("Auto Approval"); placement.setTimesheetApprovalRoute("Auto Approval"); placement.setExpenseTemplate("Default"); placement.setHolidayAccuralRate(0.12); placement.setJobDescription("Web Placement 1"); placement.setJobTitle("Web Test 001"); placement.setNoCommunications(""); placement.setPurchaseOrderNum("po_num"); placement.setSalesCostCentre("scc"); placement.setTimesheetDateCalculatorName("weekly"); placement.setPerm(false); Calendar cal1 = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT")); cal1.set(2017, 3, 1, 0, 0, 0); placement.setStart(cal1); Calendar cal2 = Calendar.getInstance(java.util.TimeZone.getTimeZone("GMT")); cal2.set(2019, 3, 1, 0, 0, 0); placement.setEnd(cal2); IntimeServiceV2_0Stub.Rate[] rates = new IntimeServiceV2_0Stub.Rate[1]; IntimeServiceV2_0Stub.Rate rate1 = new IntimeServiceV2_0Stub.Rate(); rate1.setName("Standard Day"); rate1.setPay(new BigDecimal(99.99)); rate1.setCharge(new BigDecimal(111.11)); rate1.setPayElementCode("001"); rate1.setPeriod("fixed"); rate1.setPeriodDuration(480); rate1.setPriorityOrder(0); rate1.setTimePattern("DEFAULT"); rate1.setTimesheetFields("DECIMAL"); rate1.setSelectableByWorkers(true); rates[0] = rate1; placement.setRates(rates); IntimeServiceV2_0Stub.CreateOrUpdatePlacement request = new IntimeServiceV2_0Stub.CreateOrUpdatePlacement(); request.setToken(ticket); request.setPlacement(placement); IntimeServiceV2_0Stub.CreateOrUpdatePlacementResponse result=stub.createOrUpdatePlacement(request); if (result != null) { System.out.println("Created/updated Placement with ID:" + result.get_return()); } } catch (java.lang.Exception e) { System.out.println("Exception occurred: " + e); } |
---|
...
Read a Placement
//test |
---|
- update timesheet
- ? submitTimesheet
...