Wso2Dss Box_Carring 在 WSO2esb4.8.0 中不起作用 [英] Wso2Dss Box_Carring not working in WSO2esb4.8.0

查看:14
本文介绍了Wso2Dss Box_Carring 在 WSO2esb4.8.0 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 wso2dss3.0.1 和 wso2esb4.8.0.我希望使用事务,因为我在 wso2dss 中启用了 box_carying 并且它工作正常.意味着如果第二个表也失败了我的第一个表,我希望将数据插入到 2 个表中需要回滚.此功能在 wso2dss 中工作.当我使用 wso2esb 调用相同的服务时,事务回滚不起作用 box_carying 无法正常工作,我的配置是这样的

I am working with wso2dss3.0.1 and wso2esb4.8.0.I wish to work with Transactions for that i enabled box_carying in wso2dss and its working fine.Means i wish insert the data into 2 tables if 2nd table failed my first table also need to rollback.This functionality working in wso2dss.While i am calling same service using wso2esb that time transaction rollback is not working box_carying is not working fine my configuration is like this

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="TransactionProxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="full">
            <property name="M1" value="*************HITTING Transaction PROXY*************"/>
         </log>
         <property name="OUT_ONLY" value="true"/>
         <property name="companycode" expression="//companycode/text()"/>
         <property name="companyname" expression="//companyname/text()"/>
         <property name="clientcode" expression="//clientcode/text()"/>
         <property name="clientname" expression="//clientname/text()"/>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:dat="http://ws.wso2.org/dataservice">
                  <soapenv:Header/>
                  <soapenv:Body/>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>
         <log level="full">
            <property name="M2" value="*************HITTING Transaction PROXY*************"/>
         </log>
         <header name="Action" value="urn:begin_boxcar"/>
         <callout serviceURL="http://192.168.1.201:9764/services/Transaction/begin_boxcar"
                  action="urn:begin_boxcar">
            <source type="envelope"/>
            <target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
                    xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
                    xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
         </callout>
         <payloadFactory media-type="xml">
            <format>
               <p:insertinto_mclient_OP xmlns:p="http://ws.wso2.org/dataservice">
                  <xs:clientcode xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:clientcode>
                  <xs:clientname xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:clientname>
                  <xs:createdbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:createdbyid>
                  <xs:modifiedbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:modifiedbyid>
               </p:insertinto_mclient_OP>
            </format>
            <args>
               <arg evaluator="xml" expression="get-property('clientcode')"/>
               <arg evaluator="xml" expression="get-property('clientname')"/>
            </args>
         </payloadFactory>
         <header name="Action" value="urn:insertinto_mclient_OP"/>
         <callout serviceURL="http://192.168.1.201:9764/services/Transaction/"
                  action="urn:insertinto_mclient_OP">
            <source xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
                    xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
                    xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
            <target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
                    xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
                    xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
         </callout>
         <payloadFactory media-type="xml">
            <format>
               <p:insertinto_mcompany_OP xmlns:p="http://ws.wso2.org/dataservice">
                  <xs:companycode xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:companycode>
                  <xs:comapnyname xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:comapnyname>
                  <xs:createdbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:createdbyid>
                  <xs:modifiedbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:modifiedbyid>
                  <xs:clientid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:clientid>
               </p:insertinto_mcompany_OP>
            </format>
            <args>
               <arg evaluator="xml" expression="get-property('companycode')"/>
               <arg evaluator="xml" expression="get-property('companyname')"/>
            </args>
         </payloadFactory>
         <log level="full">
            <property name="M5" value="**************hitting2nd dss*****"/>
         </log>
         <header name="Action" value="urn:insertinto_mcompany_OP"/>
         <callout serviceURL="http://192.168.1.201:9764/services/Transaction/"
                  action="urn:insertinto_mcompany_OP">
            <source xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
                    xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
                    xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
            <target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
                    xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
                    xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
         </callout>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:dat="http://ws.wso2.org/dataservice">
                  <soapenv:Header/>
                  <soapenv:Body/>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>
         <log level="full">
            <property name="M3" value="*************HITTING Transaction PROXY*************"/>
         </log>
         <header name="Action" value="urn:end_boxcar"/>
         <callout serviceURL="http://192.168.1.201:9764/services/Transaction/end_boxcar"
                  action="urn:end_boxcar">
            <source type="envelope"/>
            <target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
                    xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
                    xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
         </callout>
         <log level="full">
            <property name="M4" value="*************HITTING Transaction PROXY*************"/>
         </log>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>

如果我向 db 发送正确的值,这些值可以很好地存储在表中,但是如果我将错误的数据发送到第二个表中,即使我的第一个表存储数据第二个出错了.这里 Box_carrying 没有发生,这个版本错误是什么别的.从 wso2dss try-it 工具交易工作正常然后 y 不是来自 wso2esb 方面我遵循了这个链接在此处输入链接描述在此处输入链接描述感谢Adv..

If i send correct values to db those values are storing in tables well but if i send wrong data into second table even though my 1st table storing data 2nd is going wrong.Here Box_carrying is not happening is this version error something else.where as from wso2dss try-it tool transaction working fine then y not from wso2esb sides i followed this link enter link description here enter link description here Thanks in Adv..

推荐答案

你没有在同一个会话中进行 DSS 操作.

Your you are not doing your DSS operations in the same session.

DSS 使用 JSESSIONID cookie 来识别会话.您需要从 begin_boxcar 调用中获取该 cookie,然后将 cookie 与您希望在同一事务中执行的其余 DSS 调用一起发送.

DSS uses the JSESSIONID cookie to identify sessions. You need to grab that cookie from the begin_boxcar call and in turn send the cookie along with the rest of the DSS calls that you wish to perform in the same transaction.

最后,您需要在调用 end_boxcarabort_boxcar 时发送相同的 cookie,无论您最终调用哪个.

Finally you will need to send the same cookie in the call to end_boxcar or abort_boxcar, whichever you end up calling.

在 DSS 服务中调用 begin_boxcar 操作后,您可以通过传输属性访问服务设置的 cookie:

After your call to a begin_boxcar operation in a DSS service you can access the cookies set by the service through transport properties:

<property name="setCookieHeader" expression="$trp:Set-Cookie" action="set"/>

在 Synapse 消息上下文属性中拥有 cookie 后,您可以使用 Groovy 或 JavaScript 等脚本语言来解析 cookie 中的实际值.

After you have the cookie in a Synapse message context property you can use a scripting language such as Groovy or JavaScript to parse the actual value from the cookie.

应该在同一个 boxcarring 会话中的任何后续 DSS 调用都必须将 cookie 发送到 DSS 服务.您可以让 Axis2 通过将 cookie 设置为传输属性(在这种情况下类似于 HTTP 标头)来发送 cookie:

Any subsequent DSS calls that should be in the same boxcarring session must send the cookie to the DSS service. You can have Axis2 send the cookie by setting it to a transport property (analogous to HTTP headers in this case):

<property name="Cookie" expression="$ctx:jsessionIdCookie" action="set" scope="transport" />

这篇关于Wso2Dss Box_Carring 在 WSO2esb4.8.0 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆