Introduction
8/15/2019 - The elandings system has had public SOAP webservices available for use since ~2012. The 2012 webservices make use of older technology that make them them challenging to work with. Some of these technologies are likely to be retired from out from under us in the coming years, as Java upgrades.
...
As with the 2012 Public Webservices, the 2019 Public Webservices have three environments: TEST, TRAINING and PRODUCTION
TEST
https://elandingstest.alaska.gov/elandings/ReportManagementV1Service?wsdl
TRAINING
https://elandingst.alaska.gov/elandings/ReportManagementV1Service?wsdl
PRODUCTION
https://elandings.alaska.gov/elandings/ReportManagementV1Service?wsdl
Credentials
Just like the 2012 Public webservices, the 2019 Public webservices require that you have a user_id and password. Processors are able to create the user_id and password for 3rd party contractors in production. In Test and Training, an eLandings support person can create the user_id and password.
...
Your application id GUID will be different for TEST, TRAINING and PRODUCTION.
Example
In this example we are using Apache Netbeans 11.0.
Before running netbeans, edit the /etc/netbeans.conf to include:
-J-Djavax.xml.accessExternalSchema=all
For more details see https://netbeans.org/kb/docs/websvc/jax-ws.html
Create a new project of type Web Application
Create a new class of type Web Service from WSDL
Note: this will not be visible if you have not edited your netbeans.conf file
https://elandingstest.alaska.gov/elandings/ReportManagementV1Service?wsdl
Netbeans will generate the elandings.java class
Now Create the content of the MyClient.java class
package com.mycompany.elandingsclient2019;
import java.math.BigInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.ws.BindingProvider;
import org.psmfc.er.webservices.FindLandingReports;
import org.psmfc.er.webservices.FindLandingReportsResponse;
import org.psmfc.er.webservices.GetToken;
import org.psmfc.er.webservices.GetTokenResponse;
import org.psmfc.er.webservices.InvalidInputException_Exception;
import org.psmfc.er.webservices.LandingReport;
import org.psmfc.er.webservices.ReportManagementV1;
import org.psmfc.er.webservices.ReportManagementV1Service;
import org.psmfc.er.webservices.SecurityAuthorizationException_Exception;
import org.psmfc.er.webservices.ServiceException_Exception;
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
Get a user id and password from elandings support or a processor (if working against production).
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