quarkiverse / quarkus-cxf

Quarkus CXF Extension to support SOAP based web services.
Apache License 2.0
71 stars 57 forks source link

[Ask for help] How to modify the port used by the cxf server? #1396

Closed Caelebs closed 4 weeks ago

Caelebs commented 1 month ago

I have a webservice interface for external service calls to upload some real-time data. In addition, my project also contains some rest interfaces for web page use. The port used by my rest interface is 10010. When I configure the quarkus.http.port attribute, the soap server will also use this port. Is there any way to modify the soap service to bind to other ports? I checked the documentation quarkus-cxf, but there doesn't seem to be a suitable property

quarkus.http.host=0.0.0.0
quarkus.http.port=10010

@WebService(name = "RealTimeDataService", serviceName = "RealTimeDataService")
public interface RealTimeDataService {
    @WebMethod(operationName = "PutNewInspectResults")
    YCCommonRsp PutNewInspectResults(List<YCInspectHisResult> inspectResults);
}

@Features(features = {"org.apache.cxf.ext.logging.LoggingFeature"})
@WebService(serviceName = "RealTimeDataService", portName = "RealTimeDataServicePort")
public class RealTimeDataServiceImpl implements RealTimeDataService {

    @Inject
    RealTimeDataResource resource;

    @Inject
    RobotTaskHistoryInfoMapper historyInfoMapper;

    @Inject
    InspectTaskResultService taskResultService;

    @Override
    @WebMethod
    public YCCommonRsp PutNewInspectResults(@WebParam(name = "inspect-results", mode = WebParam.Mode.IN) List<YCInspectHisResult> inspectResults) {
        YCCommonRsp rsp = new YCCommonRsp();
        if ((null != inspectResults) && (!inspectResults.isEmpty())) {
            CompletableFuture.runAsync(() -> {
                taskResultService.saveInspectResult(inspectResults);
            }, Executors.newSingleThreadExecutor());
            inspectResults.forEach(e -> {
                RealTimeInspectTaskResultDTO realTimeResultDTO = historyInfoMapper.realTaskResult2DTO(e);
                resource.broadcast(JSONUtil.toJSON(new RealTimeDataDTO().setTaskResult(realTimeResultDTO)));
            });
        }
        rsp.setResult(0);
        rsp.setResultDesc("ok");
        return rsp;
    }
}
ppalaga commented 4 weeks ago

Is there any way to modify the soap service to bind to other ports?

No, there is no such way. We use the Quarkus HTTP layer for exposing the services. There is also no way to configure Quarkus to listen on two or more ports. Sorry.