Friday, June 27, 2014

Transaction ESB + DSS

This particular synapse configuration demos , when transaction failure scenario when box_carring is enabled.

<?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/>
         <log level="custom">
            <property name="M2" value="************HITTING Transaction PROXY************"/>
         </log>
         <header name="Action" value="urn:begin_boxcar"/>
         <property name="setCookieHeader"
                   expression="$trp:Set-Cookie"
                   scope="default"
                   type="STRING"/>
         <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>
                     <dat:begin_boxcar/>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>
         <call>
            <endpoint>
               <address uri="http://localhost:9764/services/Persons_DataService.SOAP11Endpoint/"/>
            </endpoint>
         </call>
         <property name="setCookieHeader"
                   expression="$trp:Set-Cookie"
                   scope="default"
                   type="STRING"/>
         <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>
                     <dat:insert_Persons_operation>
                        <dat:PersonID>1</dat:PersonID>
                        <dat:LastName>test</dat:LastName>
                        <dat:FirstName>test22</dat:FirstName>
                     </dat:insert_Persons_operation>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>
         <log level="custom">
            <property name="JSESSIONID" expression="get-property('setCookieHeader')"/>
         </log>
         <property name="Cookie"
                   expression="$trp:Set-Cookie"
                   scope="transport"
                   type="STRING"/>
         <header name="Action" value="urn:urn:insert_Persons_operation"/>
         <call>
            <endpoint>
               <address uri="http://localhost:9764/services/Persons_DataService.SOAP11Endpoint/"
                        format="soap11"/>
            </endpoint>
         </call>
         <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>
                     <dat:insert_Persons_operation>
                        <dat:PersonID>2</dat:PersonID>
                        <dat:LastName>mmm</dat:LastName>
                        <dat:FirstName>mmmmm</dat:FirstName>
                     </dat:insert_Persons_operation>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args/>
         </payloadFactory>
         <log level="custom">
            <property name="JSESSIONID" expression="get-property('setCookieHeader')"/>
         </log>
         <property name="Cookie"
                   expression="$ctx:setCookieHeader"
                   scope="transport"
                   type="STRING"/>
         <header name="Action" value="urn:urn:insert_Persons_operation"/>
         <call>
            <endpoint>
               <address uri="http://localhost:9764/services/Persons_DataService.SOAP11Endpoint_invalid/"
                        format="soap11"/>
            </endpoint>
         </call>
         <switch source="$axis2:HTTP_SC">
               <case regex="2[0-9][0-9]">
               <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>
                           <dat:end_boxcar/>
                        </soapenv:Body>
                     </soapenv:Envelope>
                  </format>
                  <args/>
               </payloadFactory>
               <property name="Cookie"
                         expression="get-property('setCookieHeader')"
                         scope="transport"
                         type="STRING"/>
               <header name="Action" value="urn:end_boxcar"/>
               <call>
                  <endpoint>
                     <address uri="http://localhost:9764/services/Persons_DataService.SOAP11Endpoint/"
                              format="soap11"/>
                  </endpoint>
               </call>
            </case>
            <case regex="404">
               <property name="ERROR_CODE" value="600404"/>
               <property name="ERROR_MESSAGE" value="Not Found"/>
            </case>
            <case regex="400">
               <property name="ERROR_CODE" value="600400"/>
               <property name="ERROR_MESSAGE" value="Bad Request"/>
            </case>
            <case regex="500">
               <property name="ERROR_CODE" value="600500"/>
               <property name="ERROR_MESSAGE" value="Internal Server Error"/>
            </case>
         </switch>
         <filter source="$axis2:HTTP_SC" regex="^[^2][0-9][0-9]">
            <then>
               <makefault version="soap11">
                  <code expression="get-property('ERROR_CODE')"/>
                  <reason expression="get-property('ERROR_MESSAGE')"/>
                  <detail/>
               </makefault>
            </then>
         </filter>
         <respond/>
      </inSequence>
      <outSequence>
         <drop/>
      </outSequence>
   </target>
   <description/>
</proxy>
                             
Data Service Server

<data description="multiple services per each table" enableBatchRequests="false" enableBoxcarring="true" name="Persons_DataService" serviceNamespace="http://ws.wso2.org/dataservice" serviceStatus="active">
   <config id="default">
      <property name="carbon_datasource_name">mysql</property>
   </config>
   <query id="insert_Persons_query" useConfig="default">
      <sql>INSERT INTO Persons(PersonID,LastName,FirstName) VALUES(?,?,?)</sql>
      <param name="PersonID" ordinal="1" paramType="SCALAR" sqlType="INTEGER" type="IN"/>
      <param name="LastName" ordinal="2" paramType="SCALAR" sqlType="STRING" type="IN"/>
      <param name="FirstName" ordinal="3" paramType="SCALAR" sqlType="STRING" type="IN"/>
   </query>
   <query id="select_all_Persons_query" useConfig="default">
      <sql>SELECT PersonID, LastName, FirstName FROM Persons</sql>
      <result element="PersonsCollection" rowName="Persons">
         <element column="PersonID" name="PersonID" xsdType="xs:integer"/>
         <element column="LastName" name="LastName" xsdType="xs:string"/>
         <element column="FirstName" name="FirstName" xsdType="xs:string"/>
      </result>
   </query>
   <operation name="insert_Persons_operation">
      <call-query href="insert_Persons_query">
         <with-param name="PersonID" query-param="PersonID"/>
         <with-param name="FirstName" query-param="FirstName"/>
         <with-param name="LastName" query-param="LastName"/>
      </call-query>
   </operation>
   <operation name="select_all_Persons_operation">
      <call-query href="select_all_Persons_query"/>
   </operation>
</data>


Logs
====
[2014-07-29 14:30:28,609] DEBUG - wire >> "[\r][\n]"
[2014-07-29 14:30:28,610]  INFO - LogMediator JSESSIONID = JSESSIONID=98D714A6825F25D333E87A1389C005DB; Path=/; HttpOnly
[2014-07-29 14:30:28,616] DEBUG - wire << "POST /services/Persons_DataService.SOAP11Endpoint_invalid/ HTTP/1.1[\r][\n]"
[2014-07-29 14:30:28,616] DEBUG - wire << "Cookie: JSESSIONID=98D714A6825F25D333E87A1389C005DB; Path=/; HttpOnly[\r][\n]"
[2014-07-29 14:30:28,616] DEBUG - wire << "Content-Type: text/xml[\r][\n]"
[2014-07-29 14:30:28,616] DEBUG - wire << "SOAPAction: "urn:urn:insert_Persons_operation"[\r][\n]"
[2014-07-29 14:30:28,617] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2014-07-29 14:30:28,617] DEBUG - wire << "Host: localhost:9764[\r][\n]"
[2014-07-29 14:30:28,617] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2014-07-29 14:30:28,617] DEBUG - wire << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2014-07-29 14:30:28,617] DEBUG - wire << "[\r][\n]"
[2014-07-29 14:30:28,618] DEBUG - wire << "18d[\r][\n]"
[2014-07-29 14:30:28,618] DEBUG - wire << "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dat="http://ws.wso2.org/dataservice"><soapenv:Header></soapenv:Header><soapenv:Body><dat:insert_Persons_operation><dat:PersonID>2</dat:PersonID><dat:LastName>mmm</dat:LastName><dat:FirstName>mmmmm</dat:FirstName></dat:insert_Persons_operation></soapenv:Body></soapenv:Envelope>[\r][\n]"
[2014-07-29 14:30:28,618] DEBUG - wire << "0[\r][\n]"
[2014-07-29 14:30:28,618] DEBUG - wire << "[\r][\n]"
[2014-07-29 14:30:28,624] DEBUG - wire >> "HTTP/1.1 500 Internal Server Error[\r][\n]"
[2014-07-29 14:30:28,624] DEBUG - wire >> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
[2014-07-29 14:30:28,624] DEBUG - wire >> "Transfer-Encoding: chunked[\r][\n]"
[2014-07-29 14:30:28,624] DEBUG - wire >> "Date: Tue, 29 Jul 2014 18:30:28 GMT[\r][\n]"
[2014-07-29 14:30:28,624] DEBUG - wire >> "Connection: close[\r][\n]"
[2014-07-29 14:30:28,624] DEBUG - wire >> "Server: WSO2 Carbon Server[\r][\n]"
[2014-07-29 14:30:28,625] DEBUG - wire >> "[\r][\n]"
[2014-07-29 14:30:28,625] DEBUG - wire >> "1d5[\r][\n]"
[2014-07-29 14:30:28,625] DEBUG - wire >> "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault xmlns:axis2ns6="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>axis2ns6:Client</faultcode><faultstring>The service cannot be found for the endpoint reference (EPR) http://localhost:9764/services/Persons_DataService.SOAP11Endpoint_invalid/</faultstring><detail></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>[\r][\n]"
[2014-07-29 14:30:28,626] DEBUG - wire >> "0[\r][\n]"
[2014-07-29 14:30:28,626] DEBUG - wire >> "[\r][\n]"
[2014-07-29 14:30:28,630] DEBUG - wire << "HTTP/1.1 500 Internal Server Error[\r][\n]"
[2014-07-29 14:30:28,631] DEBUG - wire << "Content-Type: text/xml;charset=UTF-8[\r][\n]"
[2014-07-29 14:30:28,631] DEBUG - wire << "Date: Tue, 29 Jul 2014 18:30:28 GMT[\r][\n]"
[2014-07-29 14:30:28,631] DEBUG - wire << "Server: WSO2-PassThrough-HTTP[\r][\n]"
[2014-07-29 14:30:28,632] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2014-07-29 14:30:28,632] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2014-07-29 14:30:28,632] DEBUG - wire << "[\r][\n]"
[2014-07-29 14:30:28,632] DEBUG - wire << "165[\r][\n]"
[2014-07-29 14:30:28,632] DEBUG - wire << "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode xmlns:axis2ns44="http://schemas.xmlsoap.org/soap/envelope/">axis2ns44:600500</faultcode><faultstring>Internal Server Error</faultstring><detail></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>[\r][\n]"
[2014-07-29 14:30:28,632] DEBUG - wire << "0[\r][\n]"
[2014-07-29 14:30:28,633] DEBUG - wire << "[\r][\n]"





No comments:

Post a Comment