Simples Assim

Posts Tagged ‘FUSE

jBPM Component for Apache Camel

leave a comment »

Written by Fernando Ribeiro

February 21, 2012 at 9:21 pm

Posted in Software

Tagged with , ,

How to Create an Apache CXF REST Web Service in Apache Camel 2.8

with one comment

SampleResource.java

import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

@Path("/sample/")
public final class SampleResource {

  @Path("/{param1}/{param2}")
  public Object sampleOperation(@PathParam("param1") final String param1, @PathParam("param2") final String param2) {
    return null;
  }

}

SampleRouteBuilder.java

import org.apache.camel.builder.RouteBuilder;

public final class SampleRouteBuilder extends RouteBuilder {

  @Override
  public void configure() {
    from("cxfrs:http://0.0.0.0:8080?resourceClasses=SampleResource")... // as per the doc, resourceClass should work
  }

}

https://issues.apache.org/jira/browse/CAMEL-5009 (vote for it!)

http://camel.apache.org/cxfrs.html

Written by Fernando Ribeiro

February 15, 2012 at 10:21 am

Posted in Software

Tagged with , ,

Improvement to Apache ServiceMix 4.4

leave a comment »

Written by Fernando Ribeiro

January 30, 2012 at 4:01 pm

Posted in Software

Tagged with ,

Improvement to Apache ServiceMix 4.4

leave a comment »

Written by Fernando Ribeiro

January 30, 2012 at 4:00 pm

Posted in Software

Tagged with ,

How to Deserialize Objects with Apache Camel 2.8

leave a comment »

import org.apache.camel.builder.RouteBuilder;

public final class SampleRouteBuilder extends RouteBuilder {

    @Override
    public void configure() {
        from(...).unmarshal().serialization();
    }

}

If you need to unmarshal an object that isn’t available to the camel-core bundle, you need enabling dynamic-import for it with the dev:dynamic-import command or using a custom processor.

http://camel.apache.org/serialization.html

Written by Fernando Ribeiro

January 19, 2012 at 11:08 pm

How to Serialize Objects with Apache Camel 2.8

leave a comment »

import org.apache.camel.builder.RouteBuilder;

public final class SampleRouteBuilder extends RouteBuilder {

    @Override
    public void configure() {
        from(...).marshal().serialization();
    }

}

http://camel.apache.org/serialization.html

Written by Fernando Ribeiro

January 19, 2012 at 10:58 pm

Posted in Software

Tagged with , ,

How to Create an Apache CXF SOAP Proxy in Apache Camel 2.8 with Apache Felix Maven Bundle Plugin 2.3.5

leave a comment »

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>br.eti.fernandoribeiro.sample</groupId>
  <artifactId>sampleroute</artifactId>
  <packaging>bundle</packaging>
  <version>1.0</version>
  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
      <version>2.8.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-cxf</artifactId>
      <version>2.8.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.3.5</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <DynamicImport-Package>*</DynamicImport-Package> <!-- replacing several Apache CXF imports -->
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

SampleService.wsdl

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.fernandoribeiro.eti.br/ws/sample" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.fernandoribeiro.eti.br/ws/sample" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:schema elementFormDefault="qualified" targetNamespace="http://www.fernandoribeiro.eti.br/ws/sample">
      <xs:element name="Sample">
        <xs:complexType />
      </xs:element>
      <xs:element name="SampleResponse">
        <xs:complexType />
      </xs:element>
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="Sample">
    <wsdl:part name="Sample" element="tns:Sample" />
  </wsdl:message>
  <wsdl:message name="SampleResponse">
    <wsdl:part name="SampleResponse" element="tns:SampleResponse" />
  </wsdl:message>
  <wsdl:portType name="SamplePortType">
    <wsdl:operation name="SampleOperation">
      <wsdl:input message="tns:Sample" />
      <wsdl:output message="tns:SampleResponse" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="SampleSoapBinding" type="tns:SamplePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="SampleOperation">
      <soap:operation soapAction="" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="SampleService">
    <wsdl:port name="SamplePort" binding="tns:SampleSoapBinding">
      <soap:address location="http://ws.fernandoribeiro.eti.br/SampleService" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">
  <bean id="routeBuilder" class="br.eti.fernandoribeiro.sample.SampleRouteBuilder" />
  <camel:camelContext>
    <camel:routeBuilder ref="routeBuilder" />
  </camel:camelContext>
  <cxf:cxfEndpoint id="cxfEndpoint" address="http://0.0.0.0:8080/ws/SampleService" wsdlURL="wsdl/SampleService.wsdl" endpointName="sample:SamplePort" serviceName="sample:SampleService" xmlns:sample="http://www.fernandoribeiro.eti.br/sample" />
</beans>

Written by Fernando Ribeiro

January 9, 2012 at 4:24 pm

Bug in FUSE 4.4.1

leave a comment »

It causes the org.apache.servicemix.nmr.api.ServiceMixException: Unable to register service servicemix-wsn2005 with properties {NAME=servicemix-wsn2005, objectClass=[Ljava.lang.String;@694d91, service.id=454, TYPE=service-engine} message to be issued on startup.

http://fusesource.com/issues/browse/ESB-1593

Fixed in SP2.

Written by Fernando Ribeiro

January 5, 2012 at 3:28 pm

Posted in Software

Tagged with ,

How to Configure Routes with Property Files in FUSE 4.4.1

leave a comment »

1) Create the <Install Dir>/etc/sample.cfg file:

key=value

2) Use the properties in your beans.xml files:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:context="http://www.springframework.org/schema/context" xmlns:osgix="http://www.springframework.org/schema/osgi-compendium" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
  <osgix:cm-properties id="config" persistent-id="sample" />
  <context:property-placeholder properties-ref="config" />
  <bean id="routeBuilder" class="br.eti.fernandoribeiro.sample.SampleRouteBuilder">
    <property name="property" value="${key}" />
  </bean>
  <camel:camelContext>
    <camel:routeBuilder ref="routeBuilder" />
  </camel:camelContext>
</beans>

http://static.springsource.org/osgi/docs/current/reference/html/compendium.html#compendium:cm:props

Written by Fernando Ribeiro

January 4, 2012 at 11:55 pm

Posted in Software

Tagged with , ,

How to Route by Apache CXF Operation in Apache Camel 2.8

leave a comment »

import org.apache.camel.builder.RouteBuilder;

public final class SampleRouteBuilder extends RouteBuilder {

    public void configure() {
        from("cxf:bean:cxfEndpoint").choice().when(simple("${property.jaxwsContext[javax.xml.ws.wsdl.operation]} == '{http://www.fernandoribeiro.eti.br}FirstOperation'}")).when(simple("${property.jaxwsContext[javax.xml.ws.wsdl.operation]} == '{http://www.fernandoribeiro.eti.br}SecondOperation'}"));
    }

}

Written by Fernando Ribeiro

January 4, 2012 at 11:19 pm

Posted in Software

Tagged with , ,

Follow

Get every new post delivered to your Inbox.

Join 787 other followers