Hi Fred,
I faced the same thing with you, please have a look at my comment on
CXF-922.
I just showed a walk around method on the CXF-922.
Willem.
Fred Dushin (JIRA) wrote:
Implicit dependency from jaxws:endpoint on httpj:engine-factory is not encoded
in Spring
----------------------------------------------------------------------------------------
Key: CXF-955
URL: https://issues.apache.org/jira/browse/CXF-955
Project: CXF
Issue Type: Bug
Reporter: Fred Dushin
Suppose an application spring-loads a jaxws:endpoint, as in:
{{{
<jaxws:endpoint
id="HttpsEndpoint"
implementor="org.apache.cxf.systest.https.GreeterImpl"
address="https://localhost:9001/SoapContext/SoapPort"
serviceName="s:SOAPService"
endpointName="e:SoapPort"
xmlns:e="http://apache.org/hello_world"
xmlns:s="http://apache.org/hello_world"/>
}}}
(IMPORTANT: Note the https protocol)
And suppose further the application tries to define the TLS parameters for
servicing listing on the IP port 9001, as follows:
{{{
<httpj:engine-factory bus="cxf" id="foo">
<!-- -->
<!-- https://localhost:9001/... -->
<!-- -->
<httpj:engine port="9001">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="password">
<sec:keyStore type="jks" resource="keys/server.jks"
password="password"/>
</sec:keyManagers>
<sec:trustManagers>
<sec:keyStore type="jks" resource="keys/truststore.jks"/>
</sec:trustManagers>
<sec:clientAuthentication want="true" required="true"/>
</httpj:tlsServerParameters>
</httpj:engine>
}}}
What will happen is that jaxws:endpoint will get instantiated before the
httpj:engine-factory (at least on the JVM I am using). This will cause the
implicit endpoint.publish to fail, because at the time the publish occurs,
there are no TLS settings established with the Bus for that physical port.
The error you will typically see is:
{{{
Caused by: java.io.IOException: Protocol mismatch: engine's protocol is http,
the url protocol is https
}}}
We need to define an implicit (or explicit) Spring dependency between these
beans.
A simple Spring "depends-on" would work, but both elements are custom XML
spring beans, so schema needs to be modified, and the beans themselves need the DependsOn
bean attribute, at a minimum. Additional work may be needed to inform Spring of the
actual dependency, so that it Does the Right Thing (r), and instantiates the
httpj:engine-factory before the jaxws:endpoint.
I have a test case for this, which I will provide a patch for shortly (if I
can't figure out how to fix the issue).