wso2: ws-discovery integration

729 Views Asked by At

WSO2 WS-Discovery Integration

We're trying to integrate WS-Discovery with the Carbon products WSO2 Governance Registry and WSO2 ESB having Apache CXF Web Service stack configured via Spring running on a Tomcat sending hello messages to the Discovery Proxy (localhost:9443/services/DiscoveryProxy) on WSO2 Greg.

Therefore 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 Greg to run WS-Discovery in managed mode. By running Tomcat and WSO2 Greg following error messages is logged in wso2Carbon.log (WSO2 Greg) ...

TID: [0] [Greg] [2013-07-15 11:45:03,411]  INFO {org.wso2.carbon.discovery.proxy.DiscoveryProxy} -  Service Discovery Failed. Retrying after 10s. {org.wso2.carbon.discovery.proxy.DiscoveryProxy}
TID: [0] [Greg] [2013-07-15 11:45:03,458] ERROR {org.wso2.carbon.governance.api.common.GovernanceArtifactManager} -  Failed to add artifact: artifact id: urn:uuid:003aa9d9-2c9f-4e0b-8415-c99632226ee3, path: /trunk/services/org/oasis_open/docs/ws_dd/ns/discovery/_2009/_01/DiscoveredService_1373881503442. An exception occurred while executing handler chain. String index out of range: -1 {org.wso2.carbon.governance.api.common.GovernanceArtifactManager}
org.wso2.carbon.registry.core.exceptions.RegistryException: An exception occurred while executing handler chain. String index out of range: -1
                at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.put(HandlerManager.java:2525)
                at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.put(HandlerLifecycleManager.java:1005)
                at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.put(EmbeddedRegistry.java:697)
                at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.put(CacheBackedRegistry.java:465)
                at org.wso2.carbon.registry.core.session.UserRegistry.put(UserRegistry.java:658)
                at org.wso2.carbon.governance.api.common.GovernanceArtifactManager.addGovernanceArtifact(GovernanceArtifactManager.java:155)
                at org.wso2.carbon.governance.api.services.ServiceManager.addService(ServiceManager.java:116)
                at org.wso2.carbon.discovery.util.DiscoveryServiceUtils.addService(DiscoveryServiceUtils.java:152)
                at org.wso2.carbon.discovery.proxy.DiscoveryProxy$1.run(DiscoveryProxy.java:89)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
                at java.util.concurrent.FutureTask.run(FutureTask.java:166)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
                at java.lang.String.substring(String.java:1911)
                at org.wso2.carbon.registry.extensions.handlers.utils.EndpointUtils.deriveEndpointFromUrl(EndpointUtils.java:674)
                at org.wso2.carbon.registry.extensions.handlers.utils.EndpointUtils.saveEndpoint(EndpointUtils.java:483)
                at org.wso2.carbon.registry.extensions.handlers.utils.EndpointUtils.saveEndpointsFromServices(EndpointUtils.java:280)
                at org.wso2.carbon.registry.extensions.handlers.ServiceMediaTypeHandler.put(ServiceMediaTypeHandler.java:353)
                at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.put(HandlerManager.java:2503)
                ... 14 more

We tried to solve this issue for several hours by reading WSO2 product documentation and searching through several forums, blogs etc. . Unfortunely we couldn't find a solution.

Remark: WS-Discovery integration with WSO2 Application Server instead of Tomcat just worked fine. But when using WSO2 ESB as an discovery client to discover services from WSO2 Greg the wizard to create proxy services out of the discoverd services on WSO2 ESB is missing the publishWSDL xml tag after creating the proxy. This tag must be added manually. Is there a way to get this done without editing this additionally??

We would be grateful for any help.

Thanks in advance

1

There are 1 best solutions below

0
On

Thank you for your quick reply

We intercepted the hello requests sent to WSO2 GReg via Tomcat and the WSO2 Application server. For this purpose we used soapUI mock services. The message requests of the soap envelopes look as follows ...

Tomcat:

<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.scheck.server.tia/">ns3:IZ3UserService</ns2:Types>
     <ns2:Scopes/>
     <ns2:XAddrs>/userService</ns2:XAddrs>
     <ns2:MetadataVersion>1</ns2:MetadataVersion>
  </ns2:Hello>
</soap:Body>
</soap:Envelope>

WSO2 Application Server:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">              
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
  <mns:serviceName xmlns:mns="http://www.wso2.org/ws/discovery">echo</mns:serviceName>
  <mns:wsdlURI xmlns:mns="http://www.wso2.org/ws/discovery">http://10.200.2.114:9764/services/echo?wsdl</mns:wsdlURI>
  <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>
  <wsa:MessageID>urn:uuid:d21e108b-34a2-4313-8b12-a22015567a51</wsa:MessageID>
  <wsa:Action>http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Hello</wsa:Action>
</soapenv:Header>
<soapenv:Body>
  <wsd:Hello xmlns:wsd="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01">
     <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:Address>urn:uuid:439a1cd5-fb36-40e2-a54e-e0cb7f3409e4</wsa:Address>
     </wsa:EndpointReference>
     <wsd:Types xmlns:axis2ns1="http://echo.services.core.carbon.wso2.org">axis2ns1:echoPortType</wsd:Types>
     <wsd:Scopes>http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/DefaultScope</wsd:Scopes>
     <wsd:XAddrs>https://10.200.2.114:9444/services/echo http://10.200.2.114:9764/services/echo</wsd:XAddrs>
     <wsd:MetadataVersion>1</wsd:MetadataVersion>
  </wsd:Hello>
  </soapenv:Body>
  </soapenv:Envelope>

Comparing both message requests we noticed that there are some tags missing like serviceName, wsdlURI and most important in our opinion the XAddrs. By adding the XAddrs manually to an soapUI request we were able to register the cxf service on WSO2 GReg. Maybe you can give us an advice how this could be achieved by configuring cxf via spring or by annotating our web service implementations.

Thanks again..this helped us very much!!