问题描述
我有一个数据服务,在仅 DSS 的环境中部署时可以完美运行.在同时具有 dss 和 esb 的环境中部署的确切数据服务将导致具有简单输入参数的操作失败.
I have a data service that works perfectly when deployed in a DSS only environment. The exact data service when deployed in an environment with both dss and esb will fail an operation that has a simple input parameter.
任何有关失败的指示将不胜感激.
Any pointers as to what is failing would be greatly appreciated.
Data 服务有两个操作;
The Data service has two operations;
- 无需输入参数即可简单获取信息,GetLastRequest
- 更复杂的获取操作,其中传入单个日期时间参数,GetNewRequests
在仅 DSS 环境中部署时,两种操作都使用 TryIT 按预期工作
When deployed in DSS only environment, both operations work as expected using TryIT
在 DSS/ESB 环境中部署时,第一个操作按预期工作.使用 TryIt 时第二次操作失败
When deployed in the DSS/ESB environment then the first operation works as expected. The second operation fails when using TryIt
操作 2:GetNewRequests
Operation 2: GetNewRequests
DSS 配置
<data name="ServiceMagnetRequestMonitor" transports="http">
<config id="ServiceMagnetStaging">
<property name="driverClassName">com.mysql.jdbc.Driver</property>
<property name="url">jdbc:mysql://localhost:3307/servicem_staging_engine</property>
<property name="username">root</property>
<property name="password">password</property>
</config>
<config id="ServiceMagnetRulesConfig">
<property name="driverClassName">com.mysql.jdbc.Driver</property>
<property name="url">jdbc:mysql://localhost:3307/servicemagnetrulesconfig</property>
<property name="username">root</property>
<property name="password">password</property>
</config>
<query id="GetLastRequest_SQL" useConfig="ServiceMagnetRulesConfig">
<sql>SELECT datevalue, NOW() as currenttime FROM dateconfigurations WHERE (configname = 'LastInspectionRequest')</sql>
<result element="Configurations" rowName="Configuration">
<element column="datevalue" name="datevalue" xsdType="dateTime"/>
<element column="currenttime" name="currenttime" xsdType="dateTime"/>
</result>
</query>
<query id="GetNewRequests_SQL" useConfig="ServiceMagnetStaging">
<sql>SELECT requests.id, requests.name, requests.telephone, requests.email, languages.name AS preflanguage, locations.name AS location, regions.name AS region, provinces.name AS province, requests.timeframe_date, requests.timeframe, requests.created_at FROM provinces, regions, locations, requests, languages WHERE provinces.id = regions.province_id AND regions.id = locations.region_id AND locations.id = requests.location_id AND requests.language_id = languages.id AND (requests.created_at > :LastRequest_IN)</sql>
<result element="Requests" rowName="Request">
<element column="id" name="id" xsdType="string"/>
<element column="name" name="name" xsdType="string"/>
<element column="telephone" name="telephone" xsdType="string"/>
<element column="email" name="email" xsdType="string"/>
<element column="preflanguage" name="preflanguage" xsdType="string"/>
<element column="location" name="location" xsdType="string"/>
<element column="region" name="region" xsdType="string"/>
<element column="province" name="province" xsdType="string"/>
<element column="timeframe_date" name="timeframe_date" xsdType="date"/>
<element column="timeframe" name="timeframe" xsdType="string"/>
<element column="created_at" name="created_at" xsdType="dateTime"/>
</result>
<param name="LastRequest_IN" sqlType="TIMESTAMP"/>
</query>
<operation name="GetLastRequest">
<call-query href="GetLastRequest_SQL"/>
</operation>
<operation name="GetNewRequests">
<call-query href="GetNewRequests_SQL">
<with-param name="LastRequest_IN" query-param="LastRequest_IN"/>
</call-query>
</operation>
</data>
使用 TryIT 返回的错误
<soapenv:Fault xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:axis2ns5336="http://ws.wso2.org/dataservice">
<soapenv:Code>
<soapenv:Value>axis2ns5336:INCOMPATIBLE_PARAMETERS_ERROR</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:LastRequest_IN
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: ServiceMagnetRequestMonitor
Location: \ServiceMagnetRequestMonitor.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: GetNewRequests
Current Params: {}
</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<axis2ns5335:DataServiceFault xmlns:axis2ns5335="http://ws.wso2.org/dataservice">DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:LastRequest_IN
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: ServiceMagnetRequestMonitor
Location: \ServiceMagnetRequestMonitor.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: GetNewRequests
Current Params: {}
</axis2ns5335:DataServiceFault>
</soapenv:Detail>
</soapenv:Fault>
推荐答案
以下实际上解决了上述问题,但真正的解决方案看起来需要 WSO2 的修复.我会为它记录一个 JIRA.
The following actually resolves the issue identified above however the real solution looks like it will require a fix from WSO2. I'll log a JIRA for it.
请注意,以下说明不会对您的安装或进一步升级造成任何问题.更改是纯粹的配置并完全受支持.
Please note, the following instructions do not cause any problems with your installation or further upgrades. The changes are pure configuration and fully supported.
问题如所报告的那样.在同一个实例中运行 DSS 和 ESB 会导致一些带有输入参数的 DSS 失败.
The problem is as reported. Running DSS and ESB in the same instance causes some DSS with input parameters to fail.
解决方案 --> 解决方法简而言之,在缺陷解决之前,您无法在同一个 Carbon 实例中运行 DSS 和 ESB.但是,您可以在两台机器上运行 DSS 和 ESB,或者如下所述,在同一台机器上运行两个实例.
The solution --> a workaroundSimply put, until the defect if resolved you cannot run DSS and ESB in the same Carbon instance. You can however run DSS and ESB on two machines or as described below, run two instances on the same machine.
呃,天哪,Rob,如果解决方案只是为了进行 DSS 操作,为什么还要付出这些努力?为什么不只设置 dss 而忘记 esb?答案是因为想要在一台机器上同时使用 dss 和 esb 的功能.如果您只需要基本的 dss 功能,那么您可以停止阅读.但如果您需要同一台机器上的两个功能,请继续.
Uhhh, gee Rob, if the solution was to just to get to a DSS operation why go through all this effort? Why not just setup dss and forget about esb? The answer due to wanting to use features of both dss and esb together on a single machine. If all you need is basic dss functionality then you can stop reading. But if you need functions from both on the same machine, please continue.
在一台机器上运行 ESB 和 DSS
- 独立安装 DSS 和 ESB.
- 确保两者都没有运行
- ESB 必须以端口偏移量 1 启动.可以在/repository/conf/carbon.xml 文件中设置端口偏移量,其中是 ESB 二进制分发文件夹.将偏移值设置为 1
- 启动两个实例
- ESB 现在需要一个代理到我们遇到问题的 DSS 服务.使用以下结构在 esb 到 dss 中创建直通代理 https://docs.wso2.com/display/ESB470/Pass+Through+Proxy+Template
- 现在使用 esb 中的 TRYIT.成功!
希望这对您有帮助.
这篇关于使用 ESB 部署时数据服务失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!