Introduction
...
Netbeans will generate the elandings.java class
Now Create the content of the MyClient.java class
package com.mycompany.elandingsclient2019;
...
public class MyClient {
String wsdlURL = "https://elandingstest.alaska.gov/elandings/ReportManagementV1Service?wsdl";
String applicationID = "...";//Ask for one of these from elandings support staff.
ReportManagementV1 serviceInstance;
String tokenId;
public MyClient(){
ReportManagementV1Service service = new ReportManagementV1Service();
serviceInstance = service.getReportManagementV1Port();
((BindingProvider) serviceInstance).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlURL);
}
public void login(String userId, String password) throws InvalidInputException_Exception, SecurityAuthorizationException_Exception, ServiceException_Exception{
GetToken parameters = new GetToken();
parameters.setUserId(userId);
parameters.setPassword(password);
GetTokenResponse token = serviceInstance.getToken(parameters, applicationID);
Logger.getLogger(MyClient.class.getName()).log(Level.INFO, "Token: "+token.getReturn());
tokenId = token.getReturn();
}
public LandingReport getLandingReport(BigInteger id, String fishTicketNumber) throws InvalidInputException_Exception, SecurityAuthorizationException_Exception, ServiceException_Exception{
FindLandingReports parameters = new FindLandingReports();
parameters.setId(id);
parameters.setFishTicket(fishTicketNumber);
FindLandingReportsResponse r = serviceInstance.findLandingReports(parameters, applicationID, tokenId);
return r.getReturn().get(0);
}
public static void main(String[] args){
try {
MyClient c = new MyClient();
String userId = "...";//Get from Processor or elandings support
String password = "...";//Get from Processor or elandings support
c.login(userId, password);
BigInteger landingReportId = BigInteger.valueOf(18378245);
String fishTicketNumber = "E19 144148";
LandingReport lr = c.getLandingReport(landingReportId, fishTicketNumber);
Logger.getLogger(MyClient.class.getName()).log(Level.INFO, "Landing Report ID: "+lr.getLandingReportId() + " last edited by "+lr.getDataEntryUser());
} catch (InvalidInputException_Exception ex) {
Logger.getLogger(MyClient.class.getName()).log(Level.SEVERE, null, ex);
} catch (SecurityAuthorizationException_Exception ex) {
Logger.getLogger(MyClient.class.getName()).log(Level.SEVERE, null, ex);
} catch (ServiceException_Exception ex) {
Logger.getLogger(MyClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//End of Class
...
In this example we will attempt to pull a landing report that we know exists from elandings test for the user tturbot.
If we run our file we should get an output of:
INFO: Landing Report ID: 18378245 last edited by AMARX