简体   繁体   English

如何使JAX-WS在生成的wsdl中使用https(http到https)作为soap:address

[英]How to make JAX-WS use https (http to https) for soap:address in generated wsdl

I am creating soap web service using jax-ws and spring. 我正在使用jax-ws和spring创建soap web服务。 Here is my code 这是我的代码

@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();
    }
}

and in application-context.xml 并在application-context.xml中

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

In generated wsdl 在生成的wsdl中

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

but i want https because my server accepts only https requests. 但我想要https,因为我的服务器仅接受https请求。

Is it possible to change http to https in this case? 在这种情况下可以将http更改为https吗?

you may need to programmatically override the endpoint: Try to change it as 您可能需要以编程方式覆盖端点:尝试将其更改为

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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM