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

查看:88
本文介绍了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试试工具交易正常运行的地方,然后从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,然后将其与您希望在同一事务中执行的其余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"/>

将cookie置于Synapse消息上下文属性中之后,可以使用脚本语言(例如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设置为传输属性(在这种情况下类似于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天全站免登陆