ventajas integrator descargar advantages adapters wso2 wso2esb

integrator - Cómo usar enrich mediator para establecer el sobre SOAP en el cuerpo XML usando WSO2 ESB



wso2 identity server (3)

¿Qué hay de usar una fábrica de carga para esto?

<payloadFactory description="Add Soap Envelop" media-type="xml"> <format> <soapenv:Envelope xmlns:bas="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData" xmlns:soap="http://www.alcatel-lucent.com/soap_cm" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> $1 </soapenv:Body> </soapenv:Envelope> </format> <args> <arg evaluator="xml" expression="get-property(''INPUT_MESSAGE'')"/> </args> </payloadFactory>

Mire el ejemplo 5 aquí en la documentación de la fábrica de carga útil

Necesito establecer un sobre de jabón para el cuerpo xml usando enriquecer mediador. Creé el cuerpo XML dentro del mediador de la fábrica de carga. Levanto ese cuerpo al valor de la propiedad. propiedad

<property expression="$body/*[1]" name="INPUT_MESSAGE" scope="default" type="OM" xmlns:ns="http://org.apache.synapse/xsd"/>

El cuerpo es así

<bas:setMOAttributes xmlns:bas="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData"> <queryXpathExp> <soap:baseObjectInstance xmlns:soap="http: //Here is only few lines

Ahora necesito agregar una envoltura de jabón. Utilicé el mediador enriquecido después de la propiedad INPUT_MESSAGE.

<enrich> <source clone="true" type="inline"> <soapenv:Envelope xmlns:bas="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData" xmlns:soap="http://www.alcatel-lucent.com/soap_cm" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <list xmlns=""/> </soapenv:Body> </soapenv:Envelope> </source> <target type="envelope"/> </enrich> <enrich> <source clone="true" property="INPUT_MESSAGE" type="property"/> <target type="body"/> </enrich>

Pero no pude obtener el cuerpo xml con envoltura de jabón. ¿Cuál es la manera de hacer esto?


Usar una fábrica de carga le dará una solución limpia. Si desea utilizar enriquecer mediador para configurar el sobre, primero debe guardarlo en una propiedad y luego utilizar la propiedad en enriquecer mediador. Lo mismo que ha hecho para guardar el cuerpo en una propiedad primero y luego usarlo en un enriquecedor mediador. Espero que ayude.


Prueba esto, funcionará

Solicitud con cuerpo como este

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.samples"> <soapenv:Header/> <soapenv:Body> <bas:setMOAttributes xmlns:bas="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData"> <queryXpathExp> <soap:baseObjectInstance xmlns:soap="http://www.alcatel-lucent.com/soap_cm"> hello </soap:baseObjectInstance> </queryXpathExp> </bas:setMOAttributes> </soapenv:Body> </soapenv:Envelope>

Proxy con enriquecer mediador como este

<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="test2" startOnLoad="true" statistics="disable" trace="disable" transports="http,https"> <target> <inSequence> <property expression="$body/*[1]" name="INPUT_MESSAGE" scope="default" type="STRING"/> <enrich> <source clone="true" type="inline"> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <list xmlns=""/> </soapenv:Body> </soapenv:Envelope> </source> <target type="envelope"/> </enrich> <enrich> <source clone="true" property="INPUT_MESSAGE" type="property"/> <target type="body"/> </enrich> <respond/> </inSequence> </target> <description/> </proxy>

Salida como esta

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <list><![CDATA[<bas:setMOAttributes xmlns:bas="http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/BasicCMIRPData"> <queryXpathExp> <soap:baseObjectInstance xmlns:soap="http://www.alcatel-lucent.com/soap_cm"> hello </soap:baseObjectInstance> </queryXpathExp> </bas:setMOAttributes>]]></list> </soapenv:Body> </soapenv:Envelope>