public Pid searchByURI(String uri) throws IOException {
        ClientResponse cr = wr.path(localPrefix)
                .queryParam(Strings.PID_RECORD_KEY_URL, uri.toString())
                .header(Strings.HEADER_ACCEPT, MediaType.APPLICATION_JSON)
                .get(ClientResponse.class);

        if (cr.getStatus() / 100 != 2) {
            throw new IOException("error when searching for URL: server returned: " + cr.getStatus());
        }

        Gson gson = new Gson();
        String json = cr.getEntity(String.class);
        if (json == null) {
            throw new IOException("null json");
        }
        if (json.isEmpty()) {
            throw new IOException("empty json");
        }

        Type listType = new TypeToken<ArrayList<String>>() {
        }.getType();
        List<String> jlist = gson.fromJson(json, listType);
        if (jlist == null) {
            throw new IOException("null json list");
        }
        if (jlist.isEmpty()) {
            throw new IOException("empty json list");
        }

        String hdl = jlist.get(0);
        if (hdl.startsWith(epicServer)) {
            hdl = hdl.substring(epicServer.length());
        } else if (hdl.startsWith(localPrefix)) {
            // fine
        } else {
            hdl = localPrefix + hdl;
        }
        return new PidImpl(this, hdl);
    }