Calling a cxf service and doing xsl transformation

View: New views
1 Messages — Rating Filter:   Alert me  

Calling a cxf service and doing xsl transformation

by skirankumars :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,
       I thought this code will be helpful to some guys who may be searching for implementing the cxf service and doing xsl transformation.


With the use of apache cxf package, you can use the wsdl2java command to generate the implementation of the code. With the generated code, you can write your own implementation and expose it as a cxf service

The following code exposes the impl file as the service implementation

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:spring="http://www.springframework.org/schema/beans"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.2"
      xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
      xmlns:cxf="http://www.mulesource.org/schema/mule/cxf/2.2"
      xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
       http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
      http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
              http://www.mulesource.org/schema/mule/xml/2.2 http://www.mulesource.org/schema/mule/xml/2.2/mule-xml.xsd
       http://www.mulesource.org/schema/mule/cxf/2.2 http://www.mulesource.org/schema/mule/cxf/2.2/mule-cxf.xsd
       "
        >
        <xm:xslt-transformer name="Xslt" xsl-file="sucess.xsl"/>
            <xm:object-to-xml-transformer name="ObjectToXML"/>
       

    <model name="cxfJaxwsModel">
        <service name="cxfJaxwsService">
            <inbound>
                <cxf:inbound-endpoint frontend="jaxws" address="http://localhost:9782/greeting"/>
            </inbound>
            <component class="pl._3e.adinterface.modeladserviceimpl"/>
           
            <outbound>
            <pass-through-router>
              <stdio:outbound-endpoint system="OUT"  transformer-refs="ObjectToXML Xslt"/>
              </pass-through-router>
            </outbound>
        </service>
    </model>
</mule>
 

The objecttoxml converts the response obtained as an object into xml and the xslt performs the trasformation and outputs the transformed xml file


I hope it can be useful to someone out there

Thanks