You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by brijesh <br...@gmail.com> on 2009/10/27 17:11:30 UTC

payload splitter and aggregation

hello there, 

One of my usecase , scenario as follows, 

I have exposed webservice using cxf-bc , incoming xml message i need to
transform and split send to two different in-out webservice , response
message of this two service i need to transform and concatenate and send
response back to service client.

can anybody suggest how do i implement above scenario using eip or camel??

I use smx 3.2.2 version. 

Thanks for the help
Regards
Brijesh N K

 


-- 
View this message in context: http://www.nabble.com/payload-splitter-and-aggregation-tp26080446p26080446.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: payload splitter and aggregation

Posted by hans couder <ha...@gmail.com>.
Hi brijesh,

What you could do is use camel route in order to transform and split
the incoming xml message.

I would do something like the following, create an abstract class so i
can also easily do some unit testing:

public abstract class AbstractRouteBuilder() extends RouteBuilder {

    protected final String DIRECT_SPLIT = "direct:split";
    protected final String DIRECT_OUT = "direct:out";
    protected final String DIRECT_AGG = "direct:agg";
    protected final String DIRECT_CLIENT = "direct:client";

    private static final DefaultNamespaceContext CONTEXT = new
DefaultNamespaceContext();
	static {
		CONTEXT.add("tag", "http://yourscheme/");
    }


     public void configure() {

      XPathBuilder<?> yourSplitter = "tag/tag:yourtag";
      yourSplitter.setNamespaceContext(CONTEXT);

      //xslt transfo + split
        from(DIRECT_SPLIT)
            .to("xslt:yourxslt.xsl")
            .splitter(yourSplitter)
            .to(DIRECT_OUT);

      //aggregator with xpath expression
       from(DIRECT_AGG)
            .aggregate()
            .xpath("yourxpathexpression", String.class)
            .to(DIRECT_CLIENT);
       }

}

public class JbiRoute() extends AbstractRouteBuilder {

  from("yourendpoint").to(DIRECT_SPLIT);
  from(DIRECT_OUT).to("yourinwebservice");
  from("youroutwebservice").to(DIRECT_AGG);
  from(DIRECT_CLIENT).to("yourserviceclient");

}


http://camel.apache.org/xslt.html
http://camel.apache.org/splitter.html
http://camel.apache.org/aggregator.html


Regards,

Hans Couder


2009/10/27 brijesh <br...@gmail.com>:
>
> hello there,
>
> One of my usecase , scenario as follows,
>
> I have exposed webservice using cxf-bc , incoming xml message i need to
> transform and split send to two different in-out webservice , response
> message of this two service i need to transform and concatenate and send
> response back to service client.
>
> can anybody suggest how do i implement above scenario using eip or camel??
>
> I use smx 3.2.2 version.
>
> Thanks for the help
> Regards
> Brijesh N K
>
>
>
>
> --
> View this message in context: http://www.nabble.com/payload-splitter-and-aggregation-tp26080446p26080446.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>