How to Set the Position of a Resource in the Oracle Field Service Cloud with the GPS API

import static java.lang.System.out;

import java.time.LocalDate;

import toatech.positioning._1.PositioningPortType;
import toatech.positioning._1.PositioningService;
import toatech.positioning._1.SetPositionElement;
import toatech.positioning._1.SetPositionListElement;
import toatech.positioning._1.SetPositionRequestElement;

public final class OfscSample {

  public static void main(final String[] args) {
    final PositioningService service = new PositioningService();

    final PositioningPortType port = service.getPositioningPort();

    final SetPositionRequestElement req = new SetPositionRequestElement();

    req.setNow("2017-01-01T00:00:00Z");

    req.setLogin("SampleLogin");

    req.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setCompany("SampleCompany");

    final SetPositionListElement data = new SetPositionListElement();

    final SetPositionElement item = new SetPositionElement();

    item.setId("1"); // external id, resource id or user id

    item.setLatitude(0f);

    item.setLongitude(0f);

    item.setTimestamp(LocalDate.of(2017, 1, 1)); //requires customization

    data.getItem().add(item);

    req.setData(data);

    out.println(port.setPosition(req));
  }

}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s