I have a WSDL that is being generated by Apache CXF WS that looks like this
<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
.
The reason behind this need. We are running a SpringBootApp on a tomcat server behind a LoadBalancer. 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
. When the wsdl is autogenerated by Apache CXF, it is generating it with the soap:address with the protocol of http
instead of https
.
In the 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 URL prefix format is protocol://host_name:port_number , for example, http:// myHost :9045 . The actual endpoint URL that is contained in a published WSDL file consists of the prefix followed by the module's context-root and the web service url-pattern, for example, http:// myHost :9045/services/ myService .
the soap:address location appears with the Hostname of the machine. This part of the xml tells the application where to find the web service. So, because the machine is in a private network, this site is unreachable to everyone behind the cloud.
WSDL, or Web Service Description Language, is an XML based definition language. It's used for describing the functionality of a SOAP based web service. WSDL files are central to testing SOAP-based services. SoapUI uses WSDL files to generate test requests, assertions and mock services.
The parameter "publishedEndpointURL" looks like the one you're searching for.
See: http://cxf.apache.org/docs/jax-ws-configuration.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With