WSO2 ESB 中有效负载工厂中的 CDATA [英] CDATA in payload factory in WSO2 ESB

查看:13
本文介绍了WSO2 ESB 中有效负载工厂中的 CDATA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 ESB 中编写一个序列并使用有效负载工厂填充我的有效负载数据,如下面的示例所述.

I am trying to write a sequence in ESB and populate my payload data by using payload factory as i stated below example.

  <payloadFactory>
     <format>
        <p:echoInt xmlns:p="http://echo.services.core.carbon.wso2.org">
           <in xmlns="">$1</in>
        </p:echoInt>
     </format>
     <args>
        <arg xmlns:ns="http://org.apache.synapse/xsd" expression="an-xml-formatted-string"/>
     </args>
  </payloadFactory>
 <send>
     <endpoint>
        <address uri="http://noon101:8280/services/echo" format="soap11"/>
     </endpoint>
  </send>

因为当我将此有效负载发送到服务时,我的字符串被格式化为 xml,所以服务会尝试解析我的 xml 参数并且(我不明白确切原因是什么)我的 Web 服务方法没有被调用.在这个 link 它说如果我使用 cdata,解析器将不会解析我的 xml 格式字符串,不会有问题.

Because my string is formatted as xml when i send this payload to the service, the service tries to parse my xml parameter and (i do not understand what is the exact reason) my web service method is not called. in this link it says that if i use cdata than the parser will not parse my xml formatted string and there will be no problem.

但问题是 Payload Factory 调解器在其内容中不接受 Cdata.当我如下所示编写 Payload Factory 的配置时,它会从中删除 CDATA 关键字,问题就出现了.

But the problem is Payload Factory mediator do not accept Cdata in its content. When i write the configuration of Payload Factory as indicated below, it deletes CDATA keywords from it and problem consists.

  <payloadFactory>
     <format>
        <p:echoInt xmlns:p="http://echo.services.core.carbon.wso2.org">
           <in xmlns=""> <![CDATA[ $1 ]]> </in>
        </p:echoInt>
     </format>
     <args>
        <arg xmlns:ns="http://org.apache.synapse/xsd" expression="an-xml-formatted-string"/>
     </args>
  </payloadFactory>

解决这个问题的方法是什么?任何其他设置有效负载或任何解决方法的中介将不胜感激.

What would be the solution to this problem? Any other mediator to set payload or any workaround will be appreciated.

推荐答案

你可以使用 XSLT mediator 来解决这个问题(Payload factory mediator 不支持 CDATA).但是如果你使用它.您还需要执行以下配置以在中介流中保留 CDATA.[1]

You can use XSLT mediator to that (Payload factory mediator does not support CDATA). But if you use it. And also you need to do the following configuration to preserve CDATA in the mediation flow. [1]

这也会很有帮助.http://tharindumathew.com/2012/05/24/添加-cdata-tags-through-xslt/

[1]http:///blog.shelan.org/2013/03/how-to-send-cdata-inside-your-soap.html

这篇关于WSO2 ESB 中有效负载工厂中的 CDATA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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