Safety Care Web Application

Free application that helps you share, process, distribute and manage your tracking information.
Construct the WebTarget:
    public RestClient() {
        client = javax.ws.rs.client.ClientBuilder
                .newBuilder()
                .sslContext(getSSLContext())
                .hostnameVerifier(getHostnameVerifier())
                .build();
        webTarget = client.target("https://www.egothor.org/safetycare-rest/rest").path("user");
        webTarget.register(new org.glassfish.jersey.client.filter.HttpBasicAuthFilter(username, password));
    }
Read location records addressed to your account. The list includes records, which were delivered after the record with id equal to last_seen. You can read all records, if the last_seen attribute is lower than 1:
    public Record[] exportInbox(long last_seen) throws ClientErrorException {
        WebTarget resource = webTarget.path("record").queryParam("last_seen", last_seen);
        return resource.request().get(Record[].class);
    }
Post a new record (id attribute must be set to null):
    public boolean addRecord(Record data) throws ClientErrorException {
        return webTarget.path("record").request().post(Entity.xml(data)).getStatus() / 100 == 2;
    }
Implement fake SSL (you would rather use a strict implementation):
    private HostnameVerifier getHostnameVerifier() {
        return new HostnameVerifierImpl();
    }

    private SSLContext getSSLContext() {
        javax.net.ssl.TrustManager x509 = new X509TrustManagerImpl();
        SSLContext ctx = null;
        try {
            ctx = SSLContext.getInstance("SSL");
            ctx.init(null, new javax.net.ssl.TrustManager[]{x509}, null);
        } catch (java.security.GeneralSecurityException ex) {
        }
        return ctx;
    }

    private static class HostnameVerifierImpl implements HostnameVerifier {

        public HostnameVerifierImpl() {
        }

        @Override
        public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
            return true;
        }
    }

    private static class X509TrustManagerImpl implements X509TrustManager {

        public X509TrustManagerImpl() {
        }

        @Override
        public void checkClientTrusted(java.security.cert.X509Certificate[] arg0, String authType) {
        }

        @Override
        public void checkServerTrusted(java.security.cert.X509Certificate[] arg0, String authType) {
        }

        @Override
        public java.security.cert.X509Certificate[] getAcceptedIssuers() {
            return new java.security.cert.X509Certificate[0];
        }
    }
The record object is
@XmlRootElement
public class Record {
    private Long id;
    private Date phoneTime;
    private String message;
    private Integer mcc;
    private Integer mnc;
    private Integer lac;
    private Integer cid;
    private Integer dbm;
    private Float accuracy;
    private Float bearing;
    private Float speed;
    private Double latitude;
    private Double longitude;
    private Double altitude;
    private String owner;
    private String producer;
    private String subscriber;

    public Record(Long id, Date phoneTime, String message, Integer mcc, Integer mnc, Integer lac, Integer cid, Integer dbm, Float accuracy, Float bearing, Float speed, Double latitude, Double longitude, Double altitude, String owner, String producer, String subscriber) {
        this.id = id;
        this.phoneTime = phoneTime;
        this.message = message;
        this.mcc = mcc;
        this.mnc = mnc;
        this.lac = lac;
        this.cid = cid;
        this.dbm = dbm;
        this.accuracy = accuracy;
        this.bearing = bearing;
        this.speed = speed;
        this.latitude = latitude;
        this.longitude = longitude;
        this.altitude = altitude;
        this.owner = owner;
        this.producer = producer;
        this.subscriber = subscriber;
    }
    
    public Record() {
        
    }

    @XmlAttribute
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    
    @XmlAttribute
    public Date getPhoneTime() {
        return phoneTime;
    }

    public void setPhoneTime(Date phoneTime) {
        this.phoneTime = phoneTime;
    }

    @XmlAttribute
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @XmlAttribute
    public Integer getMcc() {
        return mcc;
    }

    public void setMcc(Integer mcc) {
        this.mcc = mcc;
    }

    @XmlAttribute
    public Integer getMnc() {
        return mnc;
    }

    public void setMnc(Integer mnc) {
        this.mnc = mnc;
    }

    @XmlAttribute
    public Integer getLac() {
        return lac;
    }

    public void setLac(Integer lac) {
        this.lac = lac;
    }

    @XmlAttribute
    public Integer getCid() {
        return cid;
    }

    public void setCid(Integer cid) {
        this.cid = cid;
    }

    @XmlAttribute
    public Integer getDbm() {
        return dbm;
    }

    public void setDbm(Integer dbm) {
        this.dbm = dbm;
    }

    @XmlAttribute
    public Float getAccuracy() {
        return accuracy;
    }

    public void setAccuracy(Float accuracy) {
        this.accuracy = accuracy;
    }

    @XmlAttribute
    public Float getBearing() {
        return bearing;
    }

    public void setBearing(Float bearing) {
        this.bearing = bearing;
    }

    @XmlAttribute
    public Float getSpeed() {
        return speed;
    }

    public void setSpeed(Float speed) {
        this.speed = speed;
    }

    @XmlAttribute
    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    @XmlAttribute
    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    @XmlAttribute
    public Double getAltitude() {
        return altitude;
    }

    public void setAltitude(Double altitude) {
        this.altitude = altitude;
    }

    @XmlAttribute
    public String getSubscriber() {
        return subscriber;
    }

    public void setSubscriber(String subscriber) {
        this.subscriber = subscriber;
    }

    @XmlAttribute
    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    @XmlAttribute
    public String getProducer() {
        return producer;
    }

    public void setProducer(String producer) {
        this.producer = producer;
    }

    @Override
    public String toString() {
        return "Record{" + "phoneTime=" + phoneTime + ", message=" + message + ", mcc=" + mcc + ", mnc=" + mnc + ", lac=" + lac + ", cid=" + cid + ", dbm=" + dbm + ", accuracy=" + accuracy + ", bearing=" + bearing + ", speed=" + speed + ", latitude=" + latitude + ", longitude=" + longitude + ", altitude=" + altitude + ", owner=" + owner  + ", producer=" + producer  + ", subscriber=" + subscriber + '}';
    }

}