简体   繁体   English

如何在wsdl结束时更改soap地址

[英]How to change soap address at end of wsdl

I have a WSDL that is being generated by Apache CXF WS that looks like this 我有一个由Apache CXF WS生成的WSDL,看起来像这样

<wsdl:service name="MyWS">
    <wsdl:port binding="tns:MyWSSoapBinding" name="MyWSImplPort">
        <soap:address location="http://someaddress/MyApp/ws/MyWS"/>
    </wsdl:port>
</wsdl:service>

I would like to change the soap:address to have the protocol of https instead of http . 我想更改soap:address以使用https而不是http的协议。

The reason behind this need. 这种需要背后的原因。 We are running a SpringBootApp on a tomcat server behind a LoadBalancer. 我们在LoadBalancer后面的tomcat服务器上运行SpringBootApp。 The load balancer will receive the request on address https://someaddress/MyApp/ws/MyWs?wsdl and then forwards the request to the server through http . 负载均衡器将在地址https://someaddress/MyApp/ws/MyWs?wsdl上接收请求,然后通过http将请求转发给服务器。 When the wsdl is autogenerated by Apache CXF, it is generating it with the soap:address with the protocol of http instead of https . 当Apache CXF自动生成wsdl时,它使用soap:address生成它,协议为http而不是https

In the Application.java 在Application.java中

@Bean
public ServletRegistrationBean servletRegistrationBean() {
   CXFServlet servlet = new CXFServlet();
   return new ServletRegistrationBean(servlet, "/MyApp/ws/*");
}

@Bean
@Autowired
public Endpoint submitAssessment(ApplicationContext context, MyWS myWS) {
   Bus cxfBus = (Bus)context.getBean(Bus.DEFAULT_BUS_ID);
   EndpointImpl endpoint = new EndpointImpl(cxfBus, myWS);
   endpoint.setAddress("/MyWS");
   cxfBus.getInInterceptors().add(new LoggingInInterceptor());
   endpoint.publish();
   return endpoint;
}

On my Service implementation 在我的服务实现上

@Service
@WebService(serviceName = "MyWS", name = "MyWSPortType", portName = "MyWSPort", )
public class MyWSImpl implements MyWS {

The parameter "publishedEndpointURL" looks like the one you're searching for. 参数“publishedEndpointURL”看起来就像您要搜索的那个。

See: http://cxf.apache.org/docs/jax-ws-configuration.html 请参阅: http//cxf.apache.org/docs/jax-ws-configuration.html

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

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