我是 soap 和 jax-ws 的新手。
看了很多资料,知道eclipse可以抓soap messages,但是我有问题。
我的出版商
public static void main(String[] args) {
Endpoint.publish("http://localhost:8081/WS/Greeting",
new GreetingImpl());
}
我的 child
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");
}
当我在控制台中调用客户端时,我看到了
------->> Call Started
Hello, Welcom to jax-ws friend !!!
------->> Call Ended
因此它是工作服务。
但在 TCP|IP 监视器中我看到空列表。
我的TCP|IP监控配置
我做错了什么?
请帮忙)
最佳答案
我认为问题在于您的客户端直接指向端口 8081(ws 的端口),因此 tcp/ip 监视器不起作用。由于监视器正在监听端口 8080,因此您的客户端应使用此端点:
http://localhost:8080/WS/Greeting
TCP/IP 监视器将收到http 请求,然后将消息转发给
http://localhost:8081/WS/Greeting
要更改客户端使用的端点,您有两种可能性:
如果客户端使用本地 wsdl 文档(例如您在文件系统上保存了 wsdl 的副本并使用它来调用 wsimport),您可以修改其中的端点(查看元素服务在 wsdl 的末尾)。 service.getGreetingImplPort() 返回的 stub 从 wsdl 中读取端点。
您可以在客户端的main方法中使用该指令
((BindingProvider) greeting).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"http://localhost:8080/WS/Greeting");
关于java - 为什么 TCP/IP 监视器在 eclipse 中不捕获 soap 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19589677/