1

所以我一直在开发一个在客户端和服务器之间进行通信的 Web 服务。它完全可以在我的计算机上运行,​​并且能够将请求从客户端发送到服务器,而不是在同一个包中。我正在托管我的服务,例如:

public class WebServiceServer {

    public static void main(String[] args) {
        String bindingURI = "http://localhost:4040/absolute/uploadService";
        FileReceive service = new FileReceiveImpl();
        Endpoint.publish(bindingURI, service);
        System.out.println("Server started at: " + bindingURI);
    }
}

我的客户连接到我的服务,例如:

公共静态 void main(String args[]) 抛出异常 {

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(FileReceive.class);
factory.setAddress
("http://localhost:4040/absolute/uploadService");
FileReceive client =(FileReceive) factory.create();

从这一点开始,我想让网络服务公开(能够从本地主机外部连接)。我安装了 ruby​​ 和 ruby​​ gems 只是为了发现本地隧道不再可用。然后我开始使用为我转发 URL 的 ngrok,但我无法获得任何发布请求来通过它(好像它是我的 Web 服务),只能在我将 URL 输入到我的 Web 浏览器时获取方法。是否有人知道更容易使用托管服务以便某人(本地主机之外)可以将文件发布到我的网络服务?谢谢。

4

0 回答 0