【问题标题】:Record not traced into DB using WSO2 DSS未使用 WSO2 DSS 跟踪到 DB 的记录
【发布时间】:2020-11-25 13:21:47
【问题描述】:

我正在 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) &#xd;values (:LeadID,:Type,:Salutation,:FirstName,:LastName,:Email,:MobilePhone)&#xd; 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">$1</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 工具):

【问题讨论】:

    标签: wso2 wso2dss wso2ei


    【解决方案1】:

    您可以尝试在呼叫中介之前添加操作标头吗?

     <header name="Action" value="urn:Staging_Leads_Opr" scope="default"/>
    

    【讨论】:

    • 嗨@Shanaka Premarathna,感谢您的回复,尝试了同样的方法,但此操作标题对我没有帮助。
    【解决方案2】:

    我通过在有效负载工厂调解器的 arg 参数中提供输入值解决了上述问题。但仍然不知道为什么直接映射不起作用。

        <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">$1</xs:Staging_LeadsTable>
                                                <!--Exactly 1 occurrence-->
                                                <xs:LeadID xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:LeadID>
                                                <!--Exactly 1 occurrence-->
                                                <xs:Salutation xmlns:xs="http://ws.wso2.org/dataservice">$3</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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-15
      相关资源
      最近更新 更多