synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiranya Jayathilaka (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SYNAPSE-1041) xml string set in the Script mediator is not honored as OM in Fault mediator
Date Tue, 07 Jun 2016 19:27:21 GMT

    [ https://issues.apache.org/jira/browse/SYNAPSE-1041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15319180#comment-15319180
] 

Hiranya Jayathilaka commented on SYNAPSE-1041:
----------------------------------------------

I agree. Looks like the right thing to do is not allow a text string to be set as a SOAP fault
detail. Also I don't see the point of all the extra validation performed in the above code.
Is it trying to check whether the input string is valid XML? Doesn't AXIOMUtil.stringToOM
already take care of that?

> xml string set in the Script mediator is not honored as OM in Fault mediator 
> -----------------------------------------------------------------------------
>
>                 Key: SYNAPSE-1041
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-1041
>             Project: Synapse
>          Issue Type: Bug
>            Reporter: Vanjikumaran Sivajothy
>            Assignee: Hiranya Jayathilaka
>         Attachments: SYNAPSE-1041.diff, detailTransform.js, synapse_sample_2000.xml
>
>
> Sample 5 with with custom error message generated via Script mediator does not produce
the proper xml as the fault response in fault mediator.
> *Synapse Configuration*
> {code}
> <definitions xmlns="http://ws.apache.org/ns/synapse">
> <localEntry key="FaultMessageScript"
>                 src="file:repository/conf/sample/resources/script/CustomErrorMessageScript.js"/>
>     <sequence name="myFaultHandler">
>         <property name="customErrorCode" value="2016" scope="default" type="STRING"/>
>         <property name="customErrorText" value="This is Bug" scope="default" type="STRING"/>
>         <property name="customTime" expression="get-property('SYSTEM_DATE')" scope="default"
type="STRING"/>   
>        <script language="js" key="FaultMessageScript" function="transformFault"/>
>        <log level="custom">
>             <property name="**************Custom Detail*****************" expression="get-property('customErrorDetail')"
/>
>        </log>
>        <makefault version="soap11">
>             <code xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/" value="tns:Receiver"
/>
>             <reason expression="get-property('ERROR_MESSAGE')"/>
>             <detail expression="get-property('customErrorDetail')" type="OM"/>
>         </makefault>
>         <send/>
>     </sequence>
>     <sequence name="fault">
>         <log level="full">
>             <property name="MESSAGE" value="Executing default fault sequence"/>
>             <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
>             <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
>         </log>
>         <drop/>
>     </sequence>
>     <sequence name="main" onError="myFaultHandler">
>         <in>
>             <log level="full"/>
>             <switch xmlns:m0="http://services.samples" source="//m0:getQuote/m0:request/m0:symbol">
>                 <case regex="MSFT">
>                     <send>
>                         <endpoint name="testEndpoint1">
>                             <address uri="http://bogus:9000/services/NonExistentStockQuoteService"/>
>                         </endpoint>
>                     </send>
>                 </case>
>                 <case regex="SUN">
>                     <send>
>                         <endpoint name="testEndpoint2">
>                             <address uri="http://localhost:9009/services/NonExistentStockQuoteService"/>
>                         </endpoint>
>                     </send>
>                 </case>
>             </switch>
>             <drop/>
>         </in>
>         <out>
>             <send/>
>         </out>
>     </sequence>
> </definitions>
> {code}
> *Script*
> {code}
> function transformFault(mc) {
>      var symbol = mc.getPayloadXML()..*::Code.toString();
>      var errorCode = mc.getProperty("customErrorCode");
>      var errorText = mc.getProperty("customErrorText");
>      var time = mc.getProperty('customTime');
>      mc.setProperty("customErrorDetail", "<CustomErrorDetails><TimeStamp>"+time+"</TimeStamp><ErrorCode>"+errorCode+"</ErrorCode><ErrorText>"+errorText+"</ErrorText></CustomErrorDetails>");
>   }
> {code}
> *Client Request* 
> Same request as in sample 5
> {{ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8281/
-Dsymbol=SUN}}
> *Response resiveed and monitored via tcpmon*
> {code}
>  <soapenv:Fault>
>             <faultcode xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/">tns:Receiver</faultcode>
>             <faultstring>Error while connecting to the endpoint (Connection Failed)</faultstring>
>             <detail>&lt;CustomErrorDetails&gt;&lt;TimeStamp&gt;6/7/16
12:36 AM&lt;/TimeStamp&gt;&lt;ErrorCode&gt;2016&lt;/ErrorCode&gt;&lt;ErrorText&gt;This
is Bug &lt;/ErrorText&gt;&lt;/CustomErrorDetails&gt;</detail>
>  </soapenv:Fault>
> {code}
> However,expected results is 
> {code}
>   <soapenv:Fault>
>             <faultcode xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/">tns:Receiver</faultcode>
>             <faultstring>Error while connecting to the endpoint (Connection Failed)</faultstring>
>             <detail>
>                 <CustomErrorDetails>
>                     <TimeStamp>6/7/16 12:09 AM</TimeStamp>
>                     <ErrorCode>2016</ErrorCode>
>                     <ErrorText>This is Bug</ErrorText>
>                 </CustomErrorDetails>
>             </detail>
>         </soapenv:Fault>
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Mime
View raw message