Sample Java Code: LqtLocalAPIService.java
package com.loqate.ws.rest.service;
import com.loqate.ws.rest.core.LqtLocalAPICaller;
import java.util.LinkedList;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
/**
 * LqtLocalAPIService
 * This class provides the REST web service for Loqate Local API
 * It is responsible for handling the client call using REST annotations.
 *
 * This class creates a  LqtLocalAPICaller object, passes the search input
 * values supplied by a web service client to it and displays the results back.
 *
 * The @Produces annotation in the runQuery method allows it to return results
 * in both xml and JSON format.
 *
 * Sample web service call (via URL, with values):
 *  http://localhost:8084/LqtWSRestApplication/resources/query/run?organization=Loqate%20Inc.&address=1111%20Bayhill%20Drive&locality=San%20Bruno&country=USA&administrativeArea=CA&postalCode=94066
 */
@Path("/query")
public class LqtLocalAPIService {    
     @Path("/run")
     @GET
     @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
     public LinkedList
            @QueryParam("organization")       String organization,
            @QueryParam("address")            String address,
            @QueryParam("locality")           String locality,
            @QueryParam("country")            String country,
            @QueryParam("administrativeArea") String administrativeArea,
            @QueryParam("postalCode")         String postalCode
                    )
      {
             //Create list to store query results
             final LinkedList
             // Create instance of class that calls the Loqate Local API
             LqtLocalAPICaller localAPI = new LqtLocalAPICaller();
             // Run query and store results in a list
             queryResultList = localAPI.runQuery(   organization,
                                          address,
                                          locality,
                                          country,
                                          administrativeArea,
                                          postalCode
                                         );
             if (queryResultList == null) {
         System.out.println("queryResultList is null!");
             }
             return queryResultList;
     }
}