JAX-WS部署最佳实践:WSDL位置和客户端生成 [英] JAX-WS deployment best practice: WSDL location and client generation

查看:117
本文介绍了JAX-WS部署最佳实践:WSDL位置和客户端生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照以下步骤创建了Web服务:

I followed these steps to create a webservice:

  • 创建了服务接口& @WebService和@WebMethod批注的实现
  • 部署了服务
  • 使用wsimport生成的客户端存根
  • 使用如下客户端程序调用了Web服务:

  • Created a service interface & implementation with @WebService and @WebMethod annotations
  • Deployed the service
  • Generated client stubs with wsimport
  • Invoked webservice with a client program that looks like:

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

  URL url = new URL("http://SERVER:PORT/HelloWorldPOC/HelloWorldPOCImplService?wsdl");

  QName qname = new QName("http://helloworld.poc.com/", "HelloWorldPOCImplService");

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

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

  hello.execute("hello");

  System.out.println("Done");
}

问题:

  1. WSDL位置在客户端程序中提供. WSDL位置也在wsimport生成的客户端存根中进行了硬编码.为什么要这样冗余?
  2. 我使用wsimport使用"localhost"路径创建了客户端存根:

  1. The WSDL location is provided in the client program. The WSDL location is hardcoded in the wsimport generated client stub as well. Why this redundancy?
  2. I created the client stubs using wsimport using "localhost" path:

wsimport -keep http://localhost:9080/HelloWorldPOC/HelloWorldPOCImplService?wsdl

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆