WSO2 ESB- how to retrieve a property value that has xml tags using XLST mediator, all I get its '<' for '<'

我怕爱的太早我们不能终老 提交于 2019-12-11 23:20:46

问题


I am working on WSO2 ESB proxy service, where XSLT transformation needs to be done, taking a section of values from an xml and combine with the result of another .dsb file

Here is my property that has below value

*<xslt key="conf:/input/proxy_input_transform.xslt"/>
<property name="DETAILS" expression="//QUARTERLY_DATA" />
<QUARTERLY_DATA>
<ROW>
<SAP_CUST_ID>0000905133</SAP_CUST_ID>
<AOC_FLAG>N</AOC_FLAG>
<LOB>AppleCare</LOB>...."

but when a xlst is done after calling the .dbs file in the outsequence

   <xslt key="conf:/output/proxy_output_transform.xslt" >
      <property name="details" expression value="get-property('DETAILS')"/>
   </xslt>

I get the value in the transformed xml like the one below.

&lt;QUARTERLY_DATA>
&lt;ROW>
&lt;SAP_CUST_ID>0000905133&lt;/SAP_CUST_ID>
&lt;AOC_FLAG>N&lt;/AOC_FLAG>
&lt;LOB>AppleCare&lt;/LOB>....

I am not sure as why the "<" is getting changed to "&amplt;". Could someone give their findings on this? Note:I was able to successfully retrieve the value from property, that has just single value instead of the XML tags. Having the type as "OM" in property worked while placing the xml in the message context. Here is my proxy service

    <?xml version="1.0" encoding="UTF-8"?>
 <proxy xmlns="http://ws.apache.org/ns/synapse" name="TQS_SIST_BILLING_PCH_N" transports="https http" startOnLoad="true" trace="enable" statistics="enable">
    <target>
    <inSequence onError="conf:/tqs/common/FaultHandler_Seq.xml">
        <property xmlns:sist="http://sist.tqs.ist.apple.com/sist_request" name="IN_SAP_SOLD_TO" expression="//sist:ACC_BILLING_REQ_PCH_FLAG_N/sist:CUST_SRCH_INPUT/sist:SAP_SOLD_TO"/>
        <xslt key="conf:/tqs/sist/billing_pch_n/proxy_input_transform.xslt"/>
          <property name="REQUEST" value="DETAILS_REQUEST"/>
            <property name="SAP_CUST_ID" expression="//ACC_BILLING_REQ_PCH_FLAG_N" type="OM"/>
                <send>
                    <endpoint key="conf:/tqs/sist/billing_pch_n/ds_endpoint.xml"/>
                </send>
     </inSequence>
    <outSequence onError="conf:/tqs/common/FaultHandler_Seq.xml">
        <switch source="get-property('REQUEST')">
            <case regex="DETAILS_REQUEST">
                <log level="custom">
                    <property name="sequence" value="outSequence - response from Details Service"/>
                </log>
                <property name="DETAILS" expression="//QUARTERLY_DATA"/>
                <log level="custom" separator=",">
                    <property name="DETAILS------at entry level" expression="get-property('DETAILS')"/>
                </log>
                <enrich>
                    <source type="property" clone="true" property="SAP_CUST_ID"/>
                    <target type="body"/>
                </enrich>
                <log level="full">
                    <property name="sequence" value="outSequence - request for Summary Service"/>
                </log>
                <property name="REQUEST" value="SUMMARY_REQUEST"/>
                <send>
                    <endpoint key="conf:/tqs/sist/billing_pch_n/ds_summary_endpoint.xml"/>
                </send>
            </case>
            <case regex="SUMMARY_REQUEST">
                <log level="full">
                    <property name="sequence" value="outSequence  - response from Summary Service"/>
                </log>
                <log level="custom" separator=",">
                    <property name="DETAILS------222222" expression="get-property('DETAILS')"/>
                </log>
                <xslt key="conf:/tqs/sist/billing_pch_n/proxy_output_transform.xslt">
                    <property name="details" expression="get-property('DETAILS')"/>
                </xslt>
                <send/>
            </case>
        </switch>


    </outSequence>
</target>


回答1:


I think issue is in your xslt, you may used the "output method" as text.Use output method="xml"

eg: <xsl:output method="xml" version="1.0" encoding="UTF-8" />




回答2:


Can you try to edit the configuration files by directly accessing the .xml files of your configuration. Just do all of your configuration edits using a text editor and try to run your scenario. Sometimes when you are editing configurations in the management console, this kind of characters are included in the config files. Can you try with this?



来源:https://stackoverflow.com/questions/14784197/wso2-esb-how-to-retrieve-a-property-value-that-has-xml-tags-using-xlst-mediator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!