This is an example how you could report ship positions to Fleettracker by means of the WSPosition.wsdl SOAP interface.
The device type is defined in device.xsd, the pasttrack position in position.xsd.
To use the interface, you need to have API credentials. These are delivered by Herberg Systems.
We used the Eclipse Apache Axis2 Web Service Client generator in this example. Check out https://stackoverflow.com/questions/6782782/how-to-create-an-axis2-web-service-client-in-eclipse for more information.
import java.util.Calendar; import java.util.TimeZone; public class PositionHandler { /** * This method sends the given position report for the particular device. * imei: The Identifier of the device * request: The geographic position */ public synchronized void handle(String imei, IPositionReport request) throws Exception { // The adapter has been created automatically by means of the JAVA SOAP stub generator: WSFTAPIAdapter wsFTAPIAdapter = WSFTAPIAdapter.getInstance(); if (wsFTAPIAdapter == null) throw new Exception("PositionHandler.handle(): wsFTAPIAdapter is not set"); System.out.println("Received position report: IMEI: "+ imei + " " + request.toString()); // Create data to be sent to the server: WSPositionStub.ReportOwnPositionRequestData reportOwnPositionRequestData = new ReportOwnPositionRequestData(); // These are the API credentials that you obtain by Herberg Systems: WSPositionStub.APIIdentifier apiIdentifier = new WSPositionStub.APIIdentifier(); // Set the credentials: apiIdentifier.setCompanyGuid("xxx"); apiIdentifier.setClientGuid("xxx"); reportOwnPositionRequestData.setApiIdentifier(apiIdentifier); // This is the device. WSPositionStub.DeviceId deviceId = new WSPositionStub.DeviceId(); //Here, we have the IMEI as key type. You might use other key types, too if you like. Check out device.xsd deviceId.setKeyreference(WSPositionStub.Keyreference_type1.IMEI); deviceId.setVesselID(imei.trim()); reportOwnPositionRequestData.setDeviceId(deviceId); // The position dataset: WSPositionStub.PasttrackPosition pasttrackPosition = new WSPositionStub.PasttrackPosition(); if (request.isCogDegSpecified()) pasttrackPosition.setCog(request.getCogDeg()); if (request.isHdgDegSpecified()) pasttrackPosition.setHdg(request.getHdgDeg()); // We have latitude and longitude in Minutes x 1000. So, 1 degree = 60000: pasttrackPosition.setLat(request.getLatMin1000()); pasttrackPosition.setLon(request.getLonMin1000()); if (request.isSogKnotsSpecified()) pasttrackPosition.setSog(request.getSogKnots()); // The timestamp: This should normally be the timestamp of the position in UTC: Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.setTime(request.getTimestamp()); pasttrackPosition.setTimestamp(calendar); // You could add more than one position per call: WSPositionStub.PasttrackPosition[] positions = new WSPositionStub.PasttrackPosition[1]; positions[0] = pasttrackPosition; reportOwnPositionRequestData.setPositions(positions); // Send it out: wsFTAPIAdapter.reportOwnPosition(reportOwnPositionRequestData); } }