Dear All

down vote

favorite
<http://stackoverflow.com/questions/37043472/when-accessing-wso2-das-using-rest-api-using-jersey-client-im-getting-response-a#>

When accessing WSO2 DAS using REST api using jersey java rest client im
getting response as unsupported media type with response status 415 with
response
<http://stackoverflow.com/questions/37043472/when-accessing-wso2-das-using-rest-api-using-jersey-client-im-getting-response-a>

*InboundJaxrsResponse{context=ClientResponse{method=POST,
uri=https://localhost:9443/analytics/search
<https://localhost:9443/analytics/search>, status=415, reason=Unsupported
Media Type}}*

the client source below. Can anyone help on this issue.
------------------------------

package com.rilfi.research.c2c.das.rest.client;

import org.glassfish.jersey.SslConfigurator;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import javax.net.ssl.SSLContext;`enter code here`
import javax.ws.rs.client.*;
import javax.ws.rs.core.*;

public class DasClientApp {
    public static void main(String[] args) {
        SslConfigurator sslConfig = SslConfigurator.newInstance()
                .trustStoreFile("./client-truststore.jks")
                .trustStorePassword("wso2carbon")
                .keyStoreFile("wso2carbon.jks")
                .keyPassword("wso2carbon");
        SSLContext sslContext = sslConfig.createSSLContext();
        Client client =
ClientBuilder.newBuilder().sslContext(sslContext).build();
        WebTarget webTarget =
client.target("https://localhost:9443";).path("analytics/search");
        MultivaluedMap<String, String> formData = new
MultivaluedHashMap<String, String>();
        formData.add("tableName", "V1SALEFULL3");
        formData.add("query", "product:phone");
        formData.add("start", "0");
        formData.add("count", "10");
        Response response =
webTarget.request(MediaType.APPLICATION_JSON).post(Entity.form(formData));
        System.out.println(response.getStatus());
        System.out.println(response.readEntity(String.class));
        System.out.println(response);
    }

}


-- 

*M.R.M.Rilfi
M.Sc in Computer Science (Reading) Moratuwa
B.Sc Sp. Computer Science
Instructor
Dept. Computer Science & Engineering,University of Moratuwa
[email protected] <[email protected]> , [email protected] <[email protected]>
+94776284627
URL:rilfi.com <http://rilfi.com>*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to