简体   繁体   English

通过WSO2 esb中的Payload Mediator传递所有默认响应值

[英]Pass all default response values through Payload Mediator in WSO2 esb

I am using payload mediator in a proxy service deployed on WSO2 ESB to map legacy values to new ones. 我在WSO2 ESB上部署的代理服务中使用有效负载介体,以将旧值映射到新值。 It works fine but it only shows values that i have transformed. 它工作正常,但只显示我已转换的值。 I want it to show rest of response as well. 我希望它也显示其余的响应。 Is there anyway to do it by using payload mediator or any other mediator? 无论如何,可以使用有效负载中介程序或任何其他中介程序来做到这一点吗?

WSDL: WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="Person_Proxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <send>
            <endpoint>
               <address uri="http://www.example.com/xsd/Person_01_RequestResponse_001"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <payloadFactory media-type="xml">
            <format>
               <m:GetPersonResponse xmlns:m="http://example.com/TimeWriter/Person">
                  <m:NationalIdentityNumber>$1</m:NationalIdentityNumber>
                  <m:CountryCode>$2</m:CountryCode>
                  <m:FirstName>$3</m:FirstName>
                  <m:LastName>$4</m:LastName>
                  <m:HomePhone>$5</m:HomePhone>
               </m:GetPersonResponse>
            </format>
            <args>
               <arg xmlns:m0="http://www.example.com/xsd/Person_01"
                    evaluator="xml"
                    expression="//m0:CNIC"/>
               <arg xmlns:m0="http://www.example.com/xsd/Person_01"
                    evaluator="xml"
                    expression="//m0:Country"/>
               <arg xmlns:m0="http://www.example.com/xsd/Person_01"
                    evaluator="xml"
                    expression="//m0:FirstName"/>
               <arg xmlns:m0="http://www.example.com/xsd/Person_01"
                    evaluator="xml"
                    expression="//m0:LastName"/>
               <arg xmlns:m0="http://www.example.com/xsd/Person_01"
                    evaluator="xml"
                    expression="//m0:HomePhone"/>
            </args>
         </payloadFactory>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="http://localhost:8080/Person_01/services/PersonSOAP"/>
      </endpoint>
   </target>
   <description/>
</proxy>

I am getting only four attributes now in response which i have explicitly transformed. 作为响应,我现在只得到了四个属性,这些属性已经明确地转换了。 I want rest of attributes too. 我也想要其余的属性。 I am using SoapUI tool to test this service. 我正在使用SoapUI工具来测试此服务。

There are multiple options that you could try, ie use a xslt mediator, script mediator or you can have your own custom mediator to implement this transform logic. 您可以尝试多种选择,例如,使用xslt介体,脚本介体,也可以使用自己的自定义介体来实现此转换逻辑。 If you planing to go only with payload mediator you have to modify payload factory to include everything, It only outputs the content that you specified in between the "format" tags and nothing more. 如果您打算仅使用有效负载中介程序,则必须修改有效负载工厂以包括所有内容,它仅输出您在“格式”标签之间指定的内容,仅此而已。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM