# jax-ws-demo **Repository Path**: baseweb/jax-ws-demo ## Basic Information - **Project Name**: jax-ws-demo - **Description**: 演示使用jax-ws JEE 标准的 webserice的使用过程 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-12-13 - **Last Updated**: 2023-12-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 演示使用jax-ws JEE 标准的 webserice的使用过程 1. 由 provider模块 进行服务的发布 2. 利用jdk 的wsimport 工具生成桩代码: 在 consuemr 模块的根路径下执行: ```shell wsimport -p cn.johnyu.consumer.client -s src/main/java http://localhost:8080/ws/hello?wsdl ``` 此命令会在src/main/java 生成桩代码(可以整个删除client 包后重新执行) 3. 在consumer 模块中编写 ConsumerApp 完成 ws 调用 ```java public class ConsumerApp { public static void main(String[] args) { //可选: 用于设置系统属性来开启SOAP消息的日志记录。 // System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true"); // System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true"); // System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true"); // System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true"); HelloWorld service = new HelloWorldImplService().getHelloWorldImplPort(); System.out.println(service.sayHello("World")); } } ``` ### 注意:需要将项目的Project Structure的SDK版本设置成为8