简体   繁体   中英

standalone ssl web service in java

I published a standalone web service with java in a http://my-IP/ and it works.

import javax.xml.ws.Endpoint;

public class Publisher
{
    public static void main(String[] args) throws Exception
    {

        Endpoint.publish("http://172.16.58.13/", new TicketQueryImpl());
        System.out.println("UP");

    }
}

now I want to make it in SSL and publish it on https://my-IP/ .

I searched a lot but i didn't find any good sample or help. most of them were not for standalone and used Tomcat or other servers. any body could help me please!

SSL is a really complicated beast (from a programming side of things). Why not using something like nginx or Apache of your webservice proxying the requests? ie It gets an SSL connection requests, and forwards to your webservice listening in port 80.

server {
    listen              443 ssl; # Listen to SSL connections
    ssl_certificate     www.example.com.crt;
    ssl_certificate_key www.example.com.key;
    ssl_protocols       SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    server_name         my-IP.com www.my-IP.com;
    access_log          /var/log/nginx/example.com.access.log main;
    access_log          /var/log/nginx/example.com.cache.log cache;
    error_log           /var/log/nginx/example.com.error.log error;

    location / {
        proxy_pass   http://localhost:80; # Forward requests to your webservice
    }
    Include     /etc/nginx/proxy.conf; # Proxy configuration
}

See also http://nginx.org/en/docs/http/configuring_https_servers.html for more information on configuring SSL server correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM