wso2:ws-discovery整合

时间:2013-07-16 07:39:46

标签: wso2 soa esb ws-discovery

WSO2 WS-Discovery集成

我们正在尝试将WS-Discovery与Carbon产品WSO2 Governance Registry和WSO2 ESB集成 通过在Tomcat上运行的Spring配置Apache CXF Web Service堆栈,向其发送hello消息 WSO2 Greg上的发现代理(localhost:9443 / services / DiscoveryProxy)。

因此我们将cxf-services-ws-discovery-service.jar和cxf-services-ws-discovery-api.jar添加到 Tomcat中的classpath。我们进一步设置了spring bus属性org.apache.cxf.service.ws-discovery.address 到WSO2 Greg上的WS-Discovery代理的URL地址,以在托管模式下运行WS-Discovery。通过运行 Tomcat和WSO2 Greg以下错误消息记录在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

我们尝试通过阅读WSO2产品文档和搜索来解决这个问题几个小时 几个论坛,博客等。不幸的是,我们无法找到解决方案。

备注:WS-Discovery与WSO2 Application Server而不是Tomcat的集成工作正常。 但是当使用WSO2 ESB作为发现客户端来发现来自WSO2 Greg的服务时,向导可以创建代理服务。 在创建代理后,WSO2 ESB上的发现服务缺少publishWSDL xml标记。必须添加此标记 手动。有没有办法在不另外编辑的情况下完成这项工作?

我们将不胜感激任何帮助。

提前致谢

1 个答案:

答案 0 :(得分:0)

感谢您的快速回复

我们拦截了通过Tomcat和WSO2应用服务器发送给WSO2 GReg的hello请求。为此,我们使用了soapUI mock 服务。肥皂信封的消息请求如下......

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应用服务器:

<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>

比较两个消息请求,我们注意到有一些标签缺失,如serviceName,wsdlURI和最重要的 在我们看来XAddrs。通过手动添加XAddrs到soapUI请求,我们能够注册cxf服务 在WSO2 GReg上。也许你可以告诉我们如何通过spring配置cxf或者通过注释来实现 Web服务实现。

再次感谢......这对我们非常有帮助!!