java - Eclipse 中的 SOAP 消息不跟踪

标签 java eclipse web-services soap jax-ws

我是 jax-ws 的新手

我有以下界面

@WebService(name = "HelloWorld", targetNamespace = "http://pack/")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface HelloWorld {


    /**
     * 
     * @param arg0
     * @return
     *     returns java.lang.String
     */
    @WebMethod
    @WebResult(partName = "return")
    public String getHelloWorldAsString(
        @WebParam(name = "arg0", partName = "arg0")
        String arg0);

}

实现后

@WebService(endpointInterface = "pack.HelloWorld")
public class HelloWorldImpl implements HelloWorld{

    @Override
    public String getHelloWorldAsString(String name) {
        return "Hello World JAX-WS " + name;
    }

}

以下客户端代码:

public class HelloWorldClient{

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

    URL url = new URL("http://localhost:9999/ws/hello?wsdl");

        //1st argument service URI, refer to wsdl document above
    //2nd argument is service name, refer to wsdl document above
        QName qname = new QName("http://pack/", "HelloWorldImplService");

        Service service = Service.create(url, qname);

        HelloWorld hello = service.getPort(HelloWorld.class);

        System.out.println(hello.getHelloWorldAsString("mkyong"));

    }

}

在控制台我看到了

Hello World JAX-WS mkyong

TCP/IP 监视器: TCP/IP monitor

我是这样配置的: enter image description here

为什么我在 TCP/IP 监视器上看不到消息?

更新皮尼奇

如果我键入相同的本地监控端口和端口(确定按钮已禁用) 接下来我看: enter image description here

更新 2

之后

enter image description here

我看到了旧的行为

发布商

我忘记为发布者添加代码:

public class HelloWorldPublisher{

    public static void main(String[] args) {
       Endpoint.publish("http://localhost:9999/ws/hello", new HelloWorldImpl());
    }

最佳答案

我认为在“主机名”中你应该输入“localhost” 在“LocalPort”中你应该输入“9999”。

关于java - Eclipse 中的 SOAP 消息不跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19565338/

相关文章:

java - 如何在 JavaFX 中使用 FXML 创建自定义对话框?

linux - 在linux上使用eclipse设置cocos2d-x-3.6

javascript - Meteor js 使用 webservices SOAP 使用包 zardak/soap

java - SEVERE : SAAJ0537: Invalid Content-Type. 可能是错误消息而不是 SOAP 消息

java - ActiveMQ 消息不断被清除

java - Bean 在测试期间不会 Autowiring (java.lang.NullPointerException)

java - 我们可以在 Java 程序中编写 Scala 代码吗?

eclipse - 如何在 Eclipse 中访问(嵌入)Maven 控制台?

java - 如何通过Java访问SharePoint网站

java - 使用 Java 访问受 Azure Active Directory 保护的 Web 服务