Data Service fails when deployed with ESB

喜夏-厌秋 提交于 2019-12-09 18:47:59

问题


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.

The Data service has two operations;

  1. Simple get of information with no input parameters, GetLastRequest
  2. More complex get operation in which a single datetime parameter is passed in, GetNewRequests

When deployed in DSS only environment, both operations work as expected using TryIT

When deployed in the DSS/ESB environment then the first operation works as expected. The second operation fails when using TryIt

Operation 2: GetNewRequests

DSS configuration

<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&#13;FROM            provinces, regions, locations, requests, languages&#13;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 &gt; :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>

Error returned using 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>

回答1:


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.

The problem is as reported. Running DSS and ESB in the same instance causes some DSS with input parameters to fail.

The solution --> a workaround Simply 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.

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.

Running ESB and DSS on a single machine

  1. Install both DSS and ESB independently.
  2. Ensure neither are running
  3. The ESB has to be started with the port offset of 1. Port offset can be set in the /repository/conf/carbon.xml file where is the ESB binary distribution folder. Set the offset value as 1
  4. Start both instances
  5. ESB now needs a proxy to the DSS service we had problems. Create a Passthrough proxy in esb to dss using the following structions https://docs.wso2.com/display/ESB470/Pass+Through+Proxy+Template
  6. Now use TRYIT from the esb. Success!

I hope you find this helpful.




回答2:


I´ve had the same issue before, but I´ve managed to find a workaround: Replace the file $CARBON_HOME/repository/conf/axis2.xml by $CARBON_HOME/repository/conf/axis2_nhttp.xml

This will replace the Passthrough by NHTTP implementation for the HTTP(s) transport, which is the same used in the standalone DSS.

Please note that this wil have a negative performance impact on proxies, so you may prefer to stick with two carbon instances.



来源:https://stackoverflow.com/questions/30279286/data-service-fails-when-deployed-with-esb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!