WSO2:API Manager;从webservice调用publish api

时间:2013-12-10 14:11:49

标签: wso2 wso2carbon

是否可以调用WSO2 API Manager :: publisher api,如下所述:

http://docs.wso2.org/display/AM150/Publisher+APIs

来自网络服务,而不是fronm JSON

格尔茨,

马克

1 个答案:

答案 0 :(得分:0)

您只需从webservices调用那些jaggery端点即可。 对这些端点执行简单的HTTP发布;

例如:

// create a post request to addAPI.
String addAPIendpoint = "http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag";
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(addAPIendpoint);

// Request parameters and other properties.
            List<NameValuePair> params = new ArrayList<NameValuePair>(12);
params.add(new BasicNameValuePair(API_ACTION, API_ADD_ACTION));
            params.add(new BasicNameValuePair(API_NAME, serviceName));
            params.add(new BasicNameValuePair(API_CONTEXT, serviceName));
.....

    HttpResponse response = httpclient.execute(httppost, httpContext);