Skip to content

Instantly share code, notes, and snippets.

@hodrigohamalho
Last active May 11, 2017 01:25
Show Gist options
  • Select an option

  • Save hodrigohamalho/5e8292bec7b1565a228ee23b6045f3f9 to your computer and use it in GitHub Desktop.

Select an option

Save hodrigohamalho/5e8292bec7b1565a228ee23b6045f3f9 to your computer and use it in GitHub Desktop.
demo-fuse.adoc

Demo Fuse 6.3

Webservices com Mensageria em um projeto criado do Zero

Criar um projeto:

Fuse Integration Project > webservices > Runtime Fuse > Start with an empty project > Spring DSL

Code first

Copia o xml com os cabecalhos do CXF:

cp /home/rramalho/workspace/vale/resources/camel-cxf.xml

Criar a interface do webservice com.redhat.fuse.Hello :

@WebService
public interface Hello {
  String hello(@WebParam(name="name") String name, @WebParam(name="surname") String surname);
}

Declarar o cxfEndpoint no camel-cxf.xml:

<cxf:cxfEndpoint id="hello" address="http://localhost:8000/hello" serviceClass="com.redhat.fuse.Hello" />

Construcão da rota:

<route id="_webservice">
    <from id="_from1" uri="cxf:bean:hello"/>
    <log id="_log1" message="ola ${body[0]} ${body[1]}"/>
    <transform id="_return-message">
        <simple>${body[0]} and ${body[1]} </simple>
    </transform>
</route>

Contract First

Route

<route id="_webservice">
    <from id="_from1" uri="cxf:bean:hello"/>
    <log id="_log1" message="ola ${body[0]} ${body[1]}"/>
    <transform id="_return-message">
        <simple>${body[0]} and ${body[1]} </simple>
    </transform>
</route>
<route id="_from-wsdl">
    <from id="_from2" uri="cxf://ContractFirst?dataFormat=PAYLOAD&amp;wsdlURL=classpath:exemplo.wsdl"/>
    <log id="_log2" message="consumindo ${body[0]} !"/>
    <to id="_to1" uri="jms:queue:example?connectionFactory=pepe&amp;username=admin&amp;password=admin&amp;disableReplyTo=true&amp;jmsMessageType=Text"/>
</route>
Referências:
Camel in Action: https://github.com/camelinaction/camelinaction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment