Package

Source Code of BuildingTest

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.representation.Form;
import javax.ws.rs.core.MediaType;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author jeffliu
*/
public class BuildingTest {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        /*
        Client c = Client.create();
  //      WebResource r = c.resource("http://localhost:8080/fmws/resources/buildings");
        WebResource r = c.resource("http://fmii.caece.net:8080/fmws/resources/buildings");

        System.out.println("===== Create building =====");
        Form form = new Form();
        form.add("id", "myId");
        form.add("buildingName", "大成大樓888");
        ClientResponse response = r.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, form);
        System.out.println(response.getEntity(String.class));
       */

        Client c = Client.create();

        WebResource r = c.resource("http://portal.vivicloud.net/index.php/api/login_info");

        System.out.println("===== portal & trend integration =====");
        Form form = new Form();
        form.add("cookie", "myId");
        form.add("service", "大成大樓888");
        form.add("hash", "大成大樓888");

        ClientResponse response = r.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, form);
        System.out.println(response.getEntity(String.class));



    }
}
TOP

Related Classes of BuildingTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.