Re: [Dev] Loopback mediator for ESB 4.7.0
Hi Hemika, Loopback was introduced in ESB 4.8.0. If you can explain the requirement, we'll able to help you. On Fri, May 1, 2015 at 1:27 PM, Hemika Kodikara hem...@wso2.com wrote: Hi All, Is there loopback mediator in ESB 4.7.0 ? I am trying to use the following synapse in 4.7.0 which I copied from ESB 4.8.1. api xmlns=http://ws.apache.org/ns/synapse; name=jsonTest context=/json resource methods=POST inSequence loopback/ /inSequence outSequence script language=jsvar older = mc.getPayloadJSON(); var newer=older; mc.setPayloadJSON(newer);/script send/ /outSequence /resource /api I get the following error : org.apache.synapse.SynapseException: Unknown mediator referenced by configuration element : {http://ws.apache.org/ns/synapse}loopback Or is there a workaround ? Regards, Hemika Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +9477762 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- *Isuru Udana* Associate Technical Lead WSO2 Inc.; http://wso2.com email: isu...@wso2.com cell: +94 77 3791887 blog: http://mytecheye.blogspot.com/ ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Loopback mediator for ESB 4.7.0
I can't see a clear relationship between Loopback mediator and what you are trying out. But according to the proxy configuration you have given above, I guess you are trying to send a response back to the client from the proxy itself without sending the request to a backend service. For that you can reverse the message within the inSequence as follows. api xmlns=http://ws.apache.org/ns/synapse; name=jsonTest context=/json resource methods=POST inSequence script language=jsvar older = mc.getPayloadJSON(); var newer=older; mc.setPayloadJSON(newer);/script * header name=To action=remove/* * property name=RESPONSE value=true/* send/ /inSequence /resource /api Please note the highlighted lines. Thanks. On Fri, May 1, 2015 at 2:06 PM, Hemika Kodikara hem...@wso2.com wrote: Hi Isuru, Thanks for the reply. Ideally I want to experiment the following message builders(axis2.xml). !--JSON Message Builders-- messageBuilder contentType=application/json class=org.apache.synapse.commons.json.JsonBuilder/ !--messageBuilder contentType=application/json class=org.apache.synapse.commons.json.JsonStreamBuilder/-- messageBuilder contentType=application/json class=org.apache.axis2.json.JSONBuilder/ !--messageBuilder contentType=application/json class=org.apache.axis2.json.JSONStreamBuilder/-- I am invoking the following curl to invoke the api. curl -X POST -d {\origin\:\202.37.75.130\} -H Content-Type: application/json http://10.113.56.222:8280/json http://10.113.56.222:8281/json Is there a better or easier way to try them out ? Regards, Hemika Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +9477762 On Fri, May 1, 2015 at 1:38 PM, Isuru Udana isu...@wso2.com wrote: Hi Hemika, Loopback was introduced in ESB 4.8.0. If you can explain the requirement, we'll able to help you. On Fri, May 1, 2015 at 1:27 PM, Hemika Kodikara hem...@wso2.com wrote: Hi All, Is there loopback mediator in ESB 4.7.0 ? I am trying to use the following synapse in 4.7.0 which I copied from ESB 4.8.1. api xmlns=http://ws.apache.org/ns/synapse; name=jsonTest context=/json resource methods=POST inSequence loopback/ /inSequence outSequence script language=jsvar older = mc.getPayloadJSON(); var newer=older; mc.setPayloadJSON(newer);/script send/ /outSequence /resource /api I get the following error : org.apache.synapse.SynapseException: Unknown mediator referenced by configuration element : {http://ws.apache.org/ns/synapse}loopback Or is there a workaround ? Regards, Hemika Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +9477762 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- *Isuru Udana* Associate Technical Lead WSO2 Inc.; http://wso2.com email: isu...@wso2.com cell: +94 77 3791887 blog: http://mytecheye.blogspot.com/ -- *Isuru Udana* Associate Technical Lead WSO2 Inc.; http://wso2.com email: isu...@wso2.com cell: +94 77 3791887 blog: http://mytecheye.blogspot.com/ ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Loopback mediator for ESB 4.7.0
Hi Isuru, That worked!, Just what I needed. Thanks, Hemika Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +9477762 On Fri, May 1, 2015 at 2:25 PM, Isuru Udana isu...@wso2.com wrote: I can't see a clear relationship between Loopback mediator and what you are trying out. But according to the proxy configuration you have given above, I guess you are trying to send a response back to the client from the proxy itself without sending the request to a backend service. For that you can reverse the message within the inSequence as follows. api xmlns=http://ws.apache.org/ns/synapse; name=jsonTest context=/json resource methods=POST inSequence script language=jsvar older = mc.getPayloadJSON(); var newer=older; mc.setPayloadJSON(newer);/script * header name=To action=remove/* * property name=RESPONSE value=true/* send/ /inSequence /resource /api Please note the highlighted lines. Thanks. On Fri, May 1, 2015 at 2:06 PM, Hemika Kodikara hem...@wso2.com wrote: Hi Isuru, Thanks for the reply. Ideally I want to experiment the following message builders(axis2.xml). !--JSON Message Builders-- messageBuilder contentType=application/json class=org.apache.synapse.commons.json.JsonBuilder/ !--messageBuilder contentType=application/json class=org.apache.synapse.commons.json.JsonStreamBuilder/-- messageBuilder contentType=application/json class=org.apache.axis2.json.JSONBuilder/ !--messageBuilder contentType=application/json class=org.apache.axis2.json.JSONStreamBuilder/-- I am invoking the following curl to invoke the api. curl -X POST -d {\origin\:\202.37.75.130\} -H Content-Type: application/json http://10.113.56.222:8280/json http://10.113.56.222:8281/json Is there a better or easier way to try them out ? Regards, Hemika Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +9477762 On Fri, May 1, 2015 at 1:38 PM, Isuru Udana isu...@wso2.com wrote: Hi Hemika, Loopback was introduced in ESB 4.8.0. If you can explain the requirement, we'll able to help you. On Fri, May 1, 2015 at 1:27 PM, Hemika Kodikara hem...@wso2.com wrote: Hi All, Is there loopback mediator in ESB 4.7.0 ? I am trying to use the following synapse in 4.7.0 which I copied from ESB 4.8.1. api xmlns=http://ws.apache.org/ns/synapse; name=jsonTest context=/json resource methods=POST inSequence loopback/ /inSequence outSequence script language=jsvar older = mc.getPayloadJSON(); var newer=older; mc.setPayloadJSON(newer);/script send/ /outSequence /resource /api I get the following error : org.apache.synapse.SynapseException: Unknown mediator referenced by configuration element : {http://ws.apache.org/ns/synapse}loopback Or is there a workaround ? Regards, Hemika Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +9477762 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- *Isuru Udana* Associate Technical Lead WSO2 Inc.; http://wso2.com email: isu...@wso2.com cell: +94 77 3791887 blog: http://mytecheye.blogspot.com/ -- *Isuru Udana* Associate Technical Lead WSO2 Inc.; http://wso2.com email: isu...@wso2.com cell: +94 77 3791887 blog: http://mytecheye.blogspot.com/ ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Loopback mediator for ESB 4.7.0
Hi Isuru, Thanks for the reply. Ideally I want to experiment the following message builders(axis2.xml). !--JSON Message Builders-- messageBuilder contentType=application/json class=org.apache.synapse.commons.json.JsonBuilder/ !--messageBuilder contentType=application/json class=org.apache.synapse.commons.json.JsonStreamBuilder/-- messageBuilder contentType=application/json class=org.apache.axis2.json.JSONBuilder/ !--messageBuilder contentType=application/json class=org.apache.axis2.json.JSONStreamBuilder/-- I am invoking the following curl to invoke the api. curl -X POST -d {\origin\:\202.37.75.130\} -H Content-Type: application/json http://10.113.56.222:8280/json http://10.113.56.222:8281/json Is there a better or easier way to try them out ? Regards, Hemika Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +9477762 On Fri, May 1, 2015 at 1:38 PM, Isuru Udana isu...@wso2.com wrote: Hi Hemika, Loopback was introduced in ESB 4.8.0. If you can explain the requirement, we'll able to help you. On Fri, May 1, 2015 at 1:27 PM, Hemika Kodikara hem...@wso2.com wrote: Hi All, Is there loopback mediator in ESB 4.7.0 ? I am trying to use the following synapse in 4.7.0 which I copied from ESB 4.8.1. api xmlns=http://ws.apache.org/ns/synapse; name=jsonTest context=/json resource methods=POST inSequence loopback/ /inSequence outSequence script language=jsvar older = mc.getPayloadJSON(); var newer=older; mc.setPayloadJSON(newer);/script send/ /outSequence /resource /api I get the following error : org.apache.synapse.SynapseException: Unknown mediator referenced by configuration element : {http://ws.apache.org/ns/synapse}loopback Or is there a workaround ? Regards, Hemika Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +9477762 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- *Isuru Udana* Associate Technical Lead WSO2 Inc.; http://wso2.com email: isu...@wso2.com cell: +94 77 3791887 blog: http://mytecheye.blogspot.com/ ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev