From 4520df965b67dac55517f6e780f48aa0f66c12b6 Mon Sep 17 00:00:00 2001 From: Zhengjiaao Date: Fri, 4 Mar 2022 14:53:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(*)=20=E6=96=B0=E5=A2=9E-*.wsdl=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复-打包时从远程url无法读取到*.wsdl文件报错问题 --- .../starter-web-services-client/pom.xml | 10 +- .../zja/webservices/service/wsdl/UserDTO.java | 35 ++--- .../webservices/service/wsdl/UserService.java | 2 +- .../service/wsdl/UserService_Service.java | 13 +- .../src/main/resources/wsdl/author.wsdl | 142 ++++++++++++++++++ 5 files changed, 169 insertions(+), 33 deletions(-) create mode 100644 starter-web-services/starter-web-services-client/src/main/resources/wsdl/author.wsdl diff --git a/starter-web-services/starter-web-services-client/pom.xml b/starter-web-services/starter-web-services-client/pom.xml index 0bdd689..3564b52 100644 --- a/starter-web-services/starter-web-services-client/pom.xml +++ b/starter-web-services/starter-web-services-client/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.zja - spring-boot-starter-test-root + starter-web-services 2.0-SNAPSHOT @@ -75,13 +75,13 @@ ${project.basedir}/src/main/java - - http://localhost:8080/webservice/api?wsdl - + src/main/resources/wsdl/author.wsdl classpath:wsdl/author.wsdl - --> + diff --git a/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserDTO.java b/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserDTO.java index 22ab0cc..59f1d1d 100644 --- a/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserDTO.java +++ b/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserDTO.java @@ -1,8 +1,6 @@ package com.zja.webservices.service.wsdl; -import lombok.Data; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; @@ -10,9 +8,9 @@ /** *

userDTO complex type的 Java 类。 - * + * *

以下模式片段指定包含在此类中的预期内容。 - * + * *

  * <complexType name="userDTO">
  *   <complexContent>
@@ -26,10 +24,9 @@
  *   </complexContent>
  * </complexType>
  * 
- * - * + * + * */ -@Data @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "userDTO", propOrder = { "age", @@ -44,11 +41,11 @@ public class UserDTO { /** * 获取age属性的值。 - * + * * @return * possible object is * {@link Integer } - * + * */ public Integer getAge() { return age; @@ -56,11 +53,11 @@ public Integer getAge() { /** * 设置age属性的值。 - * + * * @param value * allowed object is * {@link Integer } - * + * */ public void setAge(Integer value) { this.age = value; @@ -68,11 +65,11 @@ public void setAge(Integer value) { /** * 获取id属性的值。 - * + * * @return * possible object is * {@link Long } - * + * */ public Long getId() { return id; @@ -80,11 +77,11 @@ public Long getId() { /** * 设置id属性的值。 - * + * * @param value * allowed object is * {@link Long } - * + * */ public void setId(Long value) { this.id = value; @@ -92,11 +89,11 @@ public void setId(Long value) { /** * 获取name属性的值。 - * + * * @return * possible object is * {@link String } - * + * */ public String getName() { return name; @@ -104,11 +101,11 @@ public String getName() { /** * 设置name属性的值。 - * + * * @param value * allowed object is * {@link String } - * + * */ public void setName(String value) { this.name = value; diff --git a/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserService.java b/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserService.java index 3443427..3fd8a3e 100644 --- a/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserService.java +++ b/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserService.java @@ -10,7 +10,7 @@ /** * This class was generated by Apache CXF 3.4.5 - * 2021-10-29T15:42:49.608+08:00 + * 2022-03-04T14:47:53.863+08:00 * Generated source version: 3.4.5 * */ diff --git a/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserService_Service.java b/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserService_Service.java index fa838a4..bc1427a 100644 --- a/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserService_Service.java +++ b/starter-web-services/starter-web-services-client/src/main/java/com/zja/webservices/service/wsdl/UserService_Service.java @@ -1,6 +1,5 @@ package com.zja.webservices.service.wsdl; -import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.WebEndpoint; @@ -10,12 +9,12 @@ /** * This class was generated by Apache CXF 3.4.5 - * 2021-10-29T15:42:49.636+08:00 + * 2022-03-04T14:47:53.893+08:00 * Generated source version: 3.4.5 * */ @WebServiceClient(name = "UserService", - wsdlLocation = "http://localhost:8080/webservice/api?wsdl", + wsdlLocation = "classpath:wsdl/author.wsdl", targetNamespace = "http://service.webservices.zja.com/wsdl") public class UserService_Service extends Service { @@ -24,13 +23,11 @@ public class UserService_Service extends Service { public final static QName SERVICE = new QName("http://service.webservices.zja.com/wsdl", "UserService"); public final static QName UserportName = new QName("http://service.webservices.zja.com/wsdl", "UserportName"); static { - URL url = null; - try { - url = new URL("http://localhost:8080/webservice/api?wsdl"); - } catch (MalformedURLException e) { + URL url = UserService_Service.class.getClassLoader().getResource("wsdl/author.wsdl"); + if (url == null) { java.util.logging.Logger.getLogger(UserService_Service.class.getName()) .log(java.util.logging.Level.INFO, - "Can not initialize the default wsdl from {0}", "http://localhost:8080/webservice/api?wsdl"); + "Can not initialize the default wsdl from {0}", "classpath:wsdl/author.wsdl"); } WSDL_LOCATION = url; } diff --git a/starter-web-services/starter-web-services-client/src/main/resources/wsdl/author.wsdl b/starter-web-services/starter-web-services-client/src/main/resources/wsdl/author.wsdl new file mode 100644 index 0000000..a468550 --- /dev/null +++ b/starter-web-services/starter-web-services-client/src/main/resources/wsdl/author.wsdl @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file