jax-ws客户端示例http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx?op=VerifyEmail

时间:2013-11-07 23:24:33

标签: jax-ws

我很难弄清楚如何使用wsimport使用this网络服务?

当我从http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/查看wsimport时,它应该是直接使用端口对象,但似乎我缺少一些关于jax-ws的基本知识?

编辑: 没关系我弄清楚了:D

1 个答案:

答案 0 :(得分:0)

public static void main(String args[]) {
    try {
        URL url = new URL("http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx?wsdl");
        QName qname = new QName("http://ws.cdyne.com/", "EmailVerNoTestEmail");
        Service service = Service.create(url, qname);
        EmailVerNoTestEmailSoap port = service.getPort(EmailVerNoTestEmailSoap.class);
        System.out.println(port.verifyEmail("example@gmail.com", "123").getResponseText());
    } catch (Exception e) {
        System.err.println("Error occurred while sending SOAP Request to Server");
        e.printStackTrace(System.err);
    }
}