使用 WSO2 DSS 记录未追踪到数据库中
Record not traced into DB using WSO2 DSS
我正在 WSO2 EI 6.1.1 中执行 DSS 操作。在管理控制台中检查 DSS 操作时,记录被追踪到数据库中,但是当我尝试通过编码执行相同的操作时,记录没有被追踪到数据库中,但是如果我在端点调用之后进行响应,则会获得成功作为响应。谁能告诉我这里出了什么问题?
数据服务(XML):
<data name="CarSalesDSS" transports="http https local">
<config enableOData="false" id="CarSales_DataSource">
<property name="driverClassName">com.mysql.jdbc.Driver</property>
<property name="url">url</property>
<property name="username">username</property>
<property name="password">password</property>
<property name="autoCommit">true</property>
<property name="dataSourceProps"/>
<property name="dynamicUserAuthMapping">
<configuration/>
</property>
</config>
<query id="Staging_Leads_Query" useConfig="CarSales_DataSource">
<sql>insert into :Staging_LeadsTable(LeadID,Type,Salutation,FirstName,LastName,Email,MobilePhone) 
values (:LeadID,:Type,:Salutation,:FirstName,:LastName,:Email,:MobilePhone)
 ON DUPLICATE KEY UPDATE Type =:Type,Salutation =:Salutation,FirstName =:FirstName,LastName =:LastName,Email =:Email,MobilePhone =:MobilePhone</sql>
<param name="Staging_LeadsTable" sqlType="QUERY_STRING"/>
<param name="LeadID" sqlType="STRING"/>
<param name="Salutation" sqlType="STRING"/>
<param name="Type" sqlType="STRING"/>
<param name="FirstName" sqlType="STRING"/>
<param name="LastName" sqlType="STRING"/>
<param name="Email" sqlType="STRING"/>
<param name="MobilePhone" sqlType="STRING"/>
</query>
<operation name="Staging_Leads_Opr" returnRequestStatus="true">
<call-query href="Staging_Leads_Query">
<with-param name="Staging_LeadsTable" query-param="Staging_LeadsTable"/>
<with-param name="LeadID" query-param="LeadID"/>
<with-param name="Salutation" query-param="Salutation"/>
<with-param name="Type" query-param="Type"/>
<with-param name="FirstName" query-param="FirstName"/>
<with-param name="LastName" query-param="LastName"/>
<with-param name="Email" query-param="Email"/>
<with-param name="MobilePhone" query-param="MobilePhone"/>
</call-query>
</operation>
</data>
编码中的DSS调用):
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:dat="http://ws.wso2.org/dataservice" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<p:Staging_Leads_Opr xmlns:p="http://ws.wso2.org/dataservice">
<!--Exactly 1 occurrence-->
<xs:Staging_LeadsTable xmlns:xs="http://ws.wso2.org/dataservice"></xs:Staging_LeadsTable>
<!--Exactly 1 occurrence-->
<xs:LeadID xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/Id/text()</xs:LeadID>
<!--Exactly 1 occurrence-->
<xs:Salutation xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/Salutation/text()</xs:Salutation>
<!--Exactly 1 occurrence-->
<xs:Type xmlns:xs="http://ws.wso2.org/dataservice">Lead</xs:Type>
<!--Exactly 1 occurrence-->
<xs:FirstName xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/FirstName/text()</xs:FirstName>
<!--Exactly 1 occurrence-->
<xs:LastName xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/LastName/text()</xs:LastName>
<!--Exactly 1 occurrence-->
<xs:Email xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/Email/text()</xs:Email>
<!--Exactly 1 occurrence-->
<xs:MobilePhone xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/MobilePhone/text()</xs:MobilePhone>
</p:Staging_Leads_Opr>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="get-property('Staging_LeadsTable')"/>
</args>
</payloadFactory>
<call description="CarSalesDSS">
<endpoint key="CarSalesDSS"/>
</call>
管理控制台(TryIt 工具):
你能试试在调用调解器之前添加 action header 吗?
<header name="Action" value="urn:Staging_Leads_Opr" scope="default"/>
我通过在 payload Factory 的 arg 参数中提供输入值解决了上述问题Mediator.but仍然不知道为什么直接映射不起作用。
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:dat="http://ws.wso2.org/dataservice" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<p:Staging_Leads_Opr xmlns:p="http://ws.wso2.org/dataservice">
<!--Exactly 1 occurrence-->
<xs:Staging_LeadsTable xmlns:xs="http://ws.wso2.org/dataservice"></xs:Staging_LeadsTable>
<!--Exactly 1 occurrence-->
<xs:LeadID xmlns:xs="http://ws.wso2.org/dataservice"></xs:LeadID>
<!--Exactly 1 occurrence-->
<xs:Salutation xmlns:xs="http://ws.wso2.org/dataservice"></xs:Salutation>
</p:Staging_Leads_Opr>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="get-property('Staging_LeadsTable')"/>
<arg evaluator="xml" expression="$body/jsonObject/Lead/Id/text()"/>
<arg evaluator="xml" expression="$body/jsonObject/Lead/Salutation/text()"/>
<arg evaluator="xml" value="Lead"/>
</args>
</payloadFactory>
<call description="CarSalesDSS">
<endpoint key="CarSalesDSS"/>
</call>
我正在 WSO2 EI 6.1.1 中执行 DSS 操作。在管理控制台中检查 DSS 操作时,记录被追踪到数据库中,但是当我尝试通过编码执行相同的操作时,记录没有被追踪到数据库中,但是如果我在端点调用之后进行响应,则会获得成功作为响应。谁能告诉我这里出了什么问题?
数据服务(XML):
<data name="CarSalesDSS" transports="http https local">
<config enableOData="false" id="CarSales_DataSource">
<property name="driverClassName">com.mysql.jdbc.Driver</property>
<property name="url">url</property>
<property name="username">username</property>
<property name="password">password</property>
<property name="autoCommit">true</property>
<property name="dataSourceProps"/>
<property name="dynamicUserAuthMapping">
<configuration/>
</property>
</config>
<query id="Staging_Leads_Query" useConfig="CarSales_DataSource">
<sql>insert into :Staging_LeadsTable(LeadID,Type,Salutation,FirstName,LastName,Email,MobilePhone) 
values (:LeadID,:Type,:Salutation,:FirstName,:LastName,:Email,:MobilePhone)
 ON DUPLICATE KEY UPDATE Type =:Type,Salutation =:Salutation,FirstName =:FirstName,LastName =:LastName,Email =:Email,MobilePhone =:MobilePhone</sql>
<param name="Staging_LeadsTable" sqlType="QUERY_STRING"/>
<param name="LeadID" sqlType="STRING"/>
<param name="Salutation" sqlType="STRING"/>
<param name="Type" sqlType="STRING"/>
<param name="FirstName" sqlType="STRING"/>
<param name="LastName" sqlType="STRING"/>
<param name="Email" sqlType="STRING"/>
<param name="MobilePhone" sqlType="STRING"/>
</query>
<operation name="Staging_Leads_Opr" returnRequestStatus="true">
<call-query href="Staging_Leads_Query">
<with-param name="Staging_LeadsTable" query-param="Staging_LeadsTable"/>
<with-param name="LeadID" query-param="LeadID"/>
<with-param name="Salutation" query-param="Salutation"/>
<with-param name="Type" query-param="Type"/>
<with-param name="FirstName" query-param="FirstName"/>
<with-param name="LastName" query-param="LastName"/>
<with-param name="Email" query-param="Email"/>
<with-param name="MobilePhone" query-param="MobilePhone"/>
</call-query>
</operation>
</data>
编码中的DSS调用):
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:dat="http://ws.wso2.org/dataservice" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<p:Staging_Leads_Opr xmlns:p="http://ws.wso2.org/dataservice">
<!--Exactly 1 occurrence-->
<xs:Staging_LeadsTable xmlns:xs="http://ws.wso2.org/dataservice"></xs:Staging_LeadsTable>
<!--Exactly 1 occurrence-->
<xs:LeadID xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/Id/text()</xs:LeadID>
<!--Exactly 1 occurrence-->
<xs:Salutation xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/Salutation/text()</xs:Salutation>
<!--Exactly 1 occurrence-->
<xs:Type xmlns:xs="http://ws.wso2.org/dataservice">Lead</xs:Type>
<!--Exactly 1 occurrence-->
<xs:FirstName xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/FirstName/text()</xs:FirstName>
<!--Exactly 1 occurrence-->
<xs:LastName xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/LastName/text()</xs:LastName>
<!--Exactly 1 occurrence-->
<xs:Email xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/Email/text()</xs:Email>
<!--Exactly 1 occurrence-->
<xs:MobilePhone xmlns:xs="http://ws.wso2.org/dataservice">$body/jsonObject/Lead/MobilePhone/text()</xs:MobilePhone>
</p:Staging_Leads_Opr>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="get-property('Staging_LeadsTable')"/>
</args>
</payloadFactory>
<call description="CarSalesDSS">
<endpoint key="CarSalesDSS"/>
</call>
管理控制台(TryIt 工具):
你能试试在调用调解器之前添加 action header 吗?
<header name="Action" value="urn:Staging_Leads_Opr" scope="default"/>
我通过在 payload Factory 的 arg 参数中提供输入值解决了上述问题Mediator.but仍然不知道为什么直接映射不起作用。
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:dat="http://ws.wso2.org/dataservice" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<p:Staging_Leads_Opr xmlns:p="http://ws.wso2.org/dataservice">
<!--Exactly 1 occurrence-->
<xs:Staging_LeadsTable xmlns:xs="http://ws.wso2.org/dataservice"></xs:Staging_LeadsTable>
<!--Exactly 1 occurrence-->
<xs:LeadID xmlns:xs="http://ws.wso2.org/dataservice"></xs:LeadID>
<!--Exactly 1 occurrence-->
<xs:Salutation xmlns:xs="http://ws.wso2.org/dataservice"></xs:Salutation>
</p:Staging_Leads_Opr>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="get-property('Staging_LeadsTable')"/>
<arg evaluator="xml" expression="$body/jsonObject/Lead/Id/text()"/>
<arg evaluator="xml" expression="$body/jsonObject/Lead/Salutation/text()"/>
<arg evaluator="xml" value="Lead"/>
</args>
</payloadFactory>
<call description="CarSalesDSS">
<endpoint key="CarSalesDSS"/>
</call>