为什么TCP / IP监视器不会在eclipse中捕获soap消息

时间:2013-10-25 12:17:24

标签: java eclipse web-services soap jax-ws

我是肥皂和jax-ws的新手。

在阅读了很多信息后,我知道eclipse可以捕获肥皂信息,但我有问题。

我的出版商

public static void main(String[] args) {
        Endpoint.publish("http://localhost:8081/WS/Greeting",
                new GreetingImpl());
    }

我的客户

public static void main(String[] args) {

        GreetingImplService service = new GreetingImplService();
        Greeting greeting = service.getGreetingImplPort();
        System.out.println("------->>  Call Started");
        System.out.println(greeting.sayHello("friend !!!"));
        System.out.println("------->>  Call Ended");
    }

当我在Console中调用客户端时,我看到

------->>  Call Started
Hello, Welcom to jax-ws friend !!!
------->>  Call Ended

因此,这是工作服务。

但在TCP | IP监视器中,我看到空列表。

我的TCP | IP监视器配置 enter image description here

我做错了什么?

请,帮助)

1 个答案:

答案 0 :(得分:5)

我认为问题是您的客户端直接指向端口8081(ws的端口),因此tcp / ip监视器不起作用。由于监视器正在侦听端口8080,因此您的客户端应使用此端点:

http://localhost:8080/WS/Greeting

TCP / IP监视器将接收http请求,然后将消息转发到

http://localhost:8081/WS/Greeting

要更改客户端使用的端点,您有两种可能:

  • 如果客户端使用本地wsdl文档(例如,您已在文件系统上保存了wsdl的副本并用它来调用wsimport),则可以修改其中的端点(查看元素服务)在wsdl结束时)。 service.getGreetingImplPort()返回的存根从wsdl读取端点。

  • 您可以在客户端的主要方法中使用此指令

      ((BindingProvider) greeting).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"http://localhost:8080/WS/Greeting");