WS-Discovery Integration
We're trying to integrate WS-Discovery having Cxf Web Service Stack configured
via Spring running on a Tomcat
sending hello messages to a Discovery Proxy
(localhost:9443/services/DiscoveryProxy) on WSO2 Registry.
Therefor we added 'cxf-services-ws-discovery-service.jar' and
'cxf-services-ws-discovery-api.jar' to the
classpath in Tomcat. Further we set the spring bus property
'org.apache.cxf.service.ws-discovery.address'
to the URL address of the WS-Discovery Proxy on WSO2 Registry to run
WS-Discovery in managed mode ...
<bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus"/>
<bean id="discoveryService"
class="org.apache.cxf.ws.discovery.internal.WSDiscoveryServiceImpl">
<constructor-arg index="0">
<ref bean="cxf"/>
</constructor-arg>
<constructor-arg index="1">
<map>
<entry
key="org.apache.cxf.service.ws-discovery.address"
value="https://localhost:9443/services/DiscoveryProxy"/>
</map>
</constructor-arg>
</bean>
Unfortunely we can't register our cxf services on WSO2 Registry. The WSO2
Registry sends us an error message.
To solve this problem we intercepted the hello requests sent to WSO2 Registry.
For this purpose we used
soapUI mock services. The message request of a soap envelope look as follows ...
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:tns="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01">
<soap:Header>
<wsa:Action>http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Hello</wsa:Action>
<wsa:MessageID>urn:uuid:e01ce7dc-53c0-4b36-b7d5-0e84e3bd6a5d</wsa:MessageID>
<wsa:To>https://localhost:9443/services/DiscoveryProxy</wsa:To>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
</wsa:ReplyTo>
</soap:Header>
<soap:Body>
<ns2:Hello xmlns="http://www.w3.org/2005/08/addressing"
xmlns:ns2="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01">
<EndpointReference>
<Address>urn:uuid:be46c1fc-1646-4bcc-8715-1aed4040fdd5</Address>
<ReferenceParameters/>
</EndpointReference>
<ns2:Types
xmlns:ns3="http://user.service.server/">ns3:IZ3UserService</ns2:Types>
<ns2:Scopes/>
<ns2:XAddrs>/userService</ns2:XAddrs>
<ns2:MetadataVersion>1</ns2:MetadataVersion>
</ns2:Hello>
</soap:Body>
</soap:Envelope>
Analyzing the message request we noticed that the XAddrs value matches the
relative path of a jaxws endpoint configured
in cxf.xml. By adding the absolute path to XAddrs manually the soapUI request
registered the cxf service on WSO2 Registry.
We already know that we are able to set the properties
'ws-discovery-published-url' and 'publishedEndpointUrl' in cxf.xml
to register the cxf services but we try to achive this in a more dynamic way.
We took a look into the cxf source because we would like to override an cxf
class but so far we could not find an appropriate
method to fetch the published url to set the value to one of the mentioned
properties above so that the setXAddrs method in the
WSDiscoveryServiceImpl class could get one of these properties to register the
cxf services dynamically.
We would be grateful for any advice. Maybe there is a more easier way to get
this done?
Thanks in advance