WSDL binding URL changes protocol to HTTP when beh

2019-07-23 04:01发布

问题:

We have a simple jax-ws SOAP server backed by Apache CXF 3.2.6 in standalone (self-hosted) mode that uses an embedded Jetty. The server was generated wsdl-first using CXF's wsdl2java. WSDL is a file on the classpath, and that physical WSDL file has https://.... in the location attribute of the soapbind:address element.

When started, the server publishes to http://0.0.0.0:8080. The server also sits behind an SSL termination that routes https://external-name -> SSL termination -> http://internal-name:8080, so externally the service and its WSDL are available at https://external-name.

The problem is that when the WSDL is requested from the deployed server through https://external-name?wsdl, CXF changes the location attribute of the soapbind:address element in the resulting file to http://external-name (changes the protocol to HTTP from HTTPS and retains everything else ), which causes problems with generating client proxies, Soap UI, etc.

What's worst, our service can't be consumed by our partner's SOA which enforces the usage of published location from WSDL exclusively.

How can we solve this, short of removing SSL termination and having CXF handle SSL on its own? (which is horrible, due to Java keystore maintenance nightmare and having to store the company-wide certificate + private key in the server instance).

回答1:

You can set the desired address as publishedEndpointUrl in the configuration. See: http://cxf.apache.org/docs/jax-ws-configuration.html