# webservice-demo **Repository Path**: vtech/webservice-demo ## Basic Information - **Project Name**: webservice-demo - **Description**: Web service demos use cxf - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-05-28 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Axis2 - [WebService学习之旅(七)Axis2发布WebService的几种方式](https://blog.csdn.net/Rongbo_J/article/details/51008216) - [axis2 1.7.1使用教程](http://www.cnblogs.com/firstdream/p/6394205.html) - [Axis2开发WebService客户端 的3种方式 ](http://xiaobinde.leanote.com/post/Axis2%E5%BC%80%E5%8F%91WebService%E5%AE%A2%E6%88%B7%E7%AB%AF-%E7%9A%843%E7%A7%8D%E6%96%B9%E5%BC%8F) - [利用AXIS2传递JSON数据](https://segmentfault.com/a/1190000000346631) ## Apache CXF > +Spring-boot - http://cxf.apache.org/docs/springboot.html - http://cxf.apache.org/docs/swagger2feature.html 注意: 若配置了指定的服务描述框架,如`cxf-rt-rs-service-description-swagger`或`cxf-rt-rs-service-description-openapi-v3` 则需要加上`cxf-rt-rs-service-description`依赖,默认的服务列表页面才会出现, `service-list-path`才能有效。不然报 404 错误 ## restful 服务配置 http://cxf.apache.org/docs/springboot.html ### 手动配置 在 java 的 配置类中 ```java // restful web service @Autowired private CxfRsService rsService; @Bean public Server rsServer() { final JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); endpoint.setProvider(new JacksonJsonProvider()); endpoint.setAddress("/rs"); // endpoint.setServiceBeans(Arrays.asList()); endpoint.setServiceBean(rsService); endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); return endpoint.create(); } ``` ### 自动配置 在项目的application.yml中, ```yml cxf: jaxrs: component-scan: true classes-scan-packages: org.apache.cxf.jaxrs.swagger,com.vtech.ws.cxf ``` ### web service > ws 为 context,rs 为 手动配置restful服务时的地址 默认服务列表地址:'http://host:port/context/services/services' (最后面的services可以通过`cxf.servlet.init.service-list-path`属性修改, 如`http://localhost:8008/ws/services/list`) soap: http://localhost:8008/ws/services/info?wsdl (java 配置) http://localhost:8008/ws/services/HiService?wsdl (xml配置) rest: http://localhost:8008/ws/services/rs/sayHello/cxf ( rs 为 endpoint地址,如果指定了的话。最后的cxf为输入参数); http://localhost:8008/ws/services/rs/swagger.json ### CXF Swagger - 在 `application.yaml`配置文件中配置启动swagger - 使用 `swagger.properties` 配置 swagger - 在endpoint 地址后加`swagger.json` 或 `swagger.yaml` 如,若 JAX-RS endpoint 发布地址为 `http://host:port/context/services/`, 'context' 是应用程序上下文目录, `"/services"` 是 servlet URL, Swagger documents 则为 `http://host:port/context/services/swagger.json`和 `http://host:port/context/services/swagger.yaml'` - swagger-ui 'http://host:port/context/services/api-docs/?url=/swagger.json' 或 'http://host:port/context/services/services' 页面中也有swagger-ui 的链接 设置 Swagger2Feature 的 'supportSwaggerUi' 为'false'取消对UI的激活 ### Rest 服务文件上传下载 * https://www.javatips.net/blog/cxf-rest-file-upload * https://www.javatips.net/blog/download-pdf-file-using-cxf-rest-jax-rs * https://blog.csdn.net/wodewutai17quiet/article/details/53104034 * http://cxf.apache.org/docs/jax-rs-multiparts.html ### CXF 教程 - http://cxf.apache.org/docs/how-do-i-develop-a-client.html - https://www.opencodez.com/java/soap-web-services-with-apache-cxf-spring-boot.htm - https://www.javatips.net/blog/cxf-web-service-tutorial - https://www.javatips.net/blog/cxf-restful-client - https://www.javatips.net/blog/create-cxf-client - https://www.codenotfound.com/apache-cxf-spring-boot-soap-web-service-client-server-example.html - https://www.javatips.net/blog/cxf-wsdl2java-example - https://www.javatips.net/blog/cxf-java2wsdl-example - https://www.javatips.net/blog/cxf-rest-soap-exception-handling - https://www.javatips.net/blog/mock-webservice-with-soapui - https://www.javatips.net/blog/gzip-using-cxf - https://www.javatips.net/blog/fastinfoset-using-cxf - https://www.javatips.net/blog/cxf-with-usernametoken-interceptor - https://www.javatips.net/blog/getting-ip-address-using-cxf - https://www.javatips.net/blog/apache-cxf-with-jackson - http://learningviacode.blogspot.com/2014/04/the-holder-class-in-jax-ws-why-and-how.html