我创建了一个数据服务GetDepartmentData服务,如下所示:
<data enableBatchRequests="true" name="GetDepartmentDataService" transports="http https local">
<config enableOData="false" id="LocalXEDS">
<property name="carbon_datasource_name">LocalXEDB</property>
</config>
<query id="GetDeptQuery" useConfig="LocalXEDS">
<sql>select dept_id,name,location from dept
where dept_id=?</sql>
<result element="Departments" rowName="Department">
<element column="dept_id" name="dept_id" xsdType="string"/>
<element column="name" name="name" xsdType="string"/>
<element column="location" name="location" xsdType="string"/>
</result>
<param name="dept_id" sqlType="INTEGER"/>
</query>
<operation name="GetDepartment_Operation">
<description> Returns the departments for the given department id. 
 </description>
<call-query href="GetDeptQuery">
<with-param name="dept_id" query-param="dept_id"/>
</call-query>
</operation>
</data>
字符串
我已经为数据服务创建了一个WSDL端点“MyEP”,我已经创建了ESB来调用这个数据服务,我想在CSV文件中编写响应。下面是相同的代码:
<payloadFactory media-type="xml">
<format>
<dat:GetDepartment_Operation xmlns:dat="http://ws.wso2.org/dataservice">
<dat:dept_id>$1</dat:dept_id>
</dat:GetDepartment_Operation>
</format>
<args>
<arg evaluator="xml" expression="//soapenv:Envelope/soapenv:Body/dat:GetDepartment_Operation/dat:dept_id" xmlns:dat="http://ws.wso2.org/dataservice" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>
</args>
</payloadFactory>
<call>
<endpoint key="myEP"/>
</call>
<log level="full"/>
<property name="transport.vfs.ReplyFileURI" scope="transport" type="STRING" value="file:///C:/Shilpa/sourcecode/FileConnector/Inbound?transport.vfs.Append=true"/>
<property name="transport.vfs.ReplyFileName" scope="transport" type="STRING" value="order.csv"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<property name="REST_URL_POSTFIX" scope="axis2" type="STRING" value=""/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<datamapper config="gov:datamapper/DBReadWritePSconfig.dmc" inputSchema="gov:datamapper/DBReadWritePSconfig_inputSchema.json" inputType="JSON" outputSchema="gov:datamapper/DBReadWritePSconfig_outputSchema.json" outputType="CSV"/>
<call>
<endpoint>
<address uri="vfs:file:///C:/Shilpa/sourcecode/FileConnector/Inbound/order.csv"/>
</endpoint>
</call>
型
我收到下面的日志消息和错误:
WARN - XMLInputReader Element name not found : axis2ns5:Departments
[2017-03-08 21:00:36,240] [] ERROR - DataMapperMediator DataMapper mediator : mapping failed
Input type is incorrect or Invalid element found in the message payload : axis2ns5:Departments
型
4条答案
按热度按时间gudnpqoy1#
在使用数据Map器中介之前,您必须更改有效负载,使其仅包含Department节点。
字符串
pbgvytdp2#
字符串
sr4lhrrt3#
我的输入文件示例(xml)
字符串
我的输出文件示例(csv)
id_dept,name,location 1,dep1,loc1
我的InputSchema
型
我的输出架构
型
1cosmwyk4#
它的工作!!
@ Ernesto非常感谢你的帮助。.我改变了我的dmc如下,它是工作绝对罚款。.
字符串
产出:
型