【问题标题】:How to make JAX-WS use https (http to https) for soap:address in generated wsdl如何使 JAX-WS 在生成的 wsdl 中使用 https(http 到 https)作为 soap:address
【发布时间】:2017-07-12 05:52:27
【问题描述】:

我正在使用 jax-ws 和 spring 创建soap web 服务。这是我的代码

@WebService
@Service
public class SoapService {
    SoapServiceDao soapServiceDao;
    @WebMethod(exclude = true)
    public void setSoapServiceDao(SoapServiceDao soapServiceDao) {
        this.soapServiceDao = soapServiceDao;
    }

    @WebMethod
    @SOAPBinding(parameterStyle=ParameterStyle.BARE)
    public Message method1(SoapResponse soapResponse) {
        return new Message();
    }
}

在 application-context.xml 中

<wss:binding url="/soapservice">
    <wss:service>
        <ws:service bean="#soapserviceImpl" />
    </wss:service>

在生成的wsdl中

    <soap:address location="http://localhost:8080/soapservice"/>

但我想要 https 因为我的服务器只接受 https 请求。

这种情况下可以把http改成https吗?

【问题讨论】:

    标签: java web-services soap wsdl jax-ws


    【解决方案1】:

    您可能需要以编程方式覆盖端点: 尝试将其更改为

    MyServicePort myPort = new MyServiceInterface(new URL("https://acme.com/services/MyService.svc?wsdl")).getMyPort();
    // set endpoint to use https
    String endpointURL = "https://acme.com/services/MyService.svc";
    BindingProvider bp = (BindingProvider) myPort;
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);``
    myPort.test();
    

    【讨论】:

    猜你喜欢
    • 2022-11-05
    • 2012-11-06
    • 2011-12-21
    • 2020-12-14
    • 1970-01-01
    • 2014-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多