This commit is contained in:
xd 2024-05-23 21:16:13 +08:00
parent 293ea04c85
commit 06ecd54f31
6 changed files with 106 additions and 0 deletions

View File

@ -123,6 +123,22 @@
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<!--webservice start-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.4.3</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>3.4.3</version>
</dependency>
<!--webservice end-->
</dependencies>
<build>

View File

@ -101,6 +101,7 @@ public class QuotController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('quot:quot:returnUpdate')")
@GetMapping(value = "/returnUpdate/{quotId}")
@Log(title = "报价单错误修订", businessType = BusinessType.UPDATE)
public AjaxResult getReturnUpdateInfo(@PathVariable("quotId") String quotId)
{
Quot quot = quotService.selectQuotByQuotId(quotId);

View File

@ -0,0 +1,40 @@
package com.ruoyi.web.webservice.config;
import com.ruoyi.web.webservice.service.QuotWebService;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;
@Configuration
public class WebServiceConfiguration {
@Autowired
private QuotWebService quotWebService;
@Autowired
private SpringBus spirngBus;
/**
* 发布服务
* @return
*/
@Bean
public Endpoint quotWebServiceEndpoint(){
System.out.println("服务发布");
//这里指定的端口不能跟应用的端口冲突, 单独指定
String path = "http://127.0.0.1:9090/ws/quot";
EndpointImpl endpoint = new EndpointImpl(spirngBus, quotWebService);
endpoint.publish(path);
System.out.println("服务成功path: " + path);
System.out.println(String.format("在线的wsdl%s?wsdl", path));
return endpoint ;
}
}

View File

@ -0,0 +1,13 @@
package com.ruoyi.web.webservice.domain;
public class QuotEntity {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.web.webservice.service;
import com.ruoyi.web.webservice.domain.QuotEntity;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(
name = "QuotWebService", // 暴露服务名称
targetNamespace = "http://QuotWebService.service.webservice.web.ruoyi.com"// 命名空间,一般是接口的包名倒序
)
public interface QuotWebService {
@WebMethod
QuotEntity getQuotInfo();
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.web.webservice.service.impl;
import com.ruoyi.web.webservice.domain.QuotEntity;
import com.ruoyi.web.webservice.service.QuotWebService;
import org.springframework.stereotype.Service;
import javax.jws.WebService;
@Service
@WebService(serviceName = "QuotWebService", // 与接口中指定的name一致, 都可以不写
targetNamespace = "http://QuotWebService.service.webservice.web.ruoyi.com", // 与接口中的命名空间一致,一般是接口的包名倒都可以不用写
endpointInterface = "com.ruoyi.web.webservice.service.QuotWebService" // 接口类全路径
)
public class QuotWebServiceImpl implements QuotWebService {
@Override
public QuotEntity getQuotInfo() {
QuotEntity quot = new QuotEntity();
quot.setName("测试");
return quot;
}
}