0

I'm new to MSF4J micorservices. I was trying out a hello-world MSF4J example as given here: https://javahelps.com/wso2-msf4j-hello-world. Everything works as expected, but when I try to access the service using an https url https://localhost:8080/service in the Chrome browser, I am getting an error as This site can’t provide a secure connection. ERR_SSL_PROTOCOL_ERROR.

I'm using Java 8 and my code is this (only two Java classes):

import javax.ws.rs.*;

@Path("/service")
public class HelloService {

    @GET
    @Path("/")
    public String get() {
        System.out.println("GET invoked");
        return "Hello world!";
    }

    @POST
    @Path("/")
    public void post() {
        System.out.println("POST invoked");
    }
}
public class Main {
    public static void main(String[] args) {
        new MicroservicesRunner(8080).
            deploy(new HelloService())
               .start();
    }
}

Dependencies in pom.xml:

<dependencies>
    <dependency>
        <groupId>org.wso2.msf4j</groupId>
        <artifactId>msf4j-core</artifactId>
        <version>2.5.2</version>
    </dependency>
    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0.1</version>
    </dependency>
</dependencies>

Is it possible to enable https connection with this service? if yes, then how can it be done?

I found some https configuration here: https://github.com/wso2/msf4j/blob/master/samples/spring-helloworld/README.md#2-configuring-https-transport . But I am not sure if this configuration method should be used here, as it says "Configuring MSF4J through Spring" in its title and I am not using any Spring libraries.

Any help would be greatly appreciated.

jogi343
  • 1
  • 1

0 Answers0