Overview
In this blog we show how to use the sap-netweaver component in Fuse.
Setup a SAP Developer Account
In order to run the project a SAP Developer account should be setup. Visit the Developer Page at http://scn.sap.com/docs/DOC-31221 Also visit the Red Hat JBoss Enterprise Middleware for SAP page on SCN at http://scn.sap.com/docs/DOC-39134
Running a test of the component
Step 1 - Download the Project from https://github.com/kpeeples/Fuse-sap-netweaver-gateway-component
Step 2 - Import the Project into JBDS
JBDS - https://www.jboss.org/products/jbds.html
Core Update http://download.jboss.org/jbosstools/updates/stable/kepler/
Integration Stack http://download.jboss.org/jbosstools/updates/development/kepler/integration-stack/
Step 3 - Update the Username and Password in the camel-context.xml
Step 4 - Right click on camel-context.xml and run as 'Local Camel Context'
Step 5 - The output will look like the below in the console:
[pache.camel.spring.Main.main()] MainSupport INFO Apache Camel 2.12.0.redhat-610-SNAPSHOT starting
[pache.camel.spring.Main.main()] ileSystemXmlApplicationContext INFO Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@6fc0394c: startup date [Wed Oct 23 11:52:53 EDT 2013]; root of context hierarchy
[pache.camel.spring.Main.main()] XmlBeanDefinitionReader INFO Loading XML bean definitions from URL [file:/home/kpeeples/workspace/camel-spring/src/main/resources/META-INF/spring/camel-context.xml]
[pache.camel.spring.Main.main()] DefaultListableBeanFactory INFO Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@15222f9f: defining beans [template,consumerTemplate,camel-1:beanPostProcessor,camel-1]; root of factory hierarchy
[pache.camel.spring.Main.main()] SpringCamelContext INFO Apache Camel 2.12.0.redhat-610-SNAPSHOT (CamelContext: camel-1) is starting
[pache.camel.spring.Main.main()] ManagedManagementStrategy INFO JMX is enabled
[pache.camel.spring.Main.main()] DefaultTypeConverter INFO Loaded 191 type converters
[pache.camel.spring.Main.main()] SpringCamelContext INFO StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
[pache.camel.spring.Main.main()] FileEndpoint INFO Endpoint is configured with noop=true so forcing endpoint to be idempotent as well
[pache.camel.spring.Main.main()] FileEndpoint INFO Using default memory based idempotent repository with cache max size: 1000
[pache.camel.spring.Main.main()] NetWeaverProducer INFO Creating NetWeaverProducer using url: https://sapes1.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/?authUsername=P1940066098&authPassword=xxxxxx&authMethod=Basic
[pache.camel.spring.Main.main()] SpringCamelContext INFO Route: route1 started and consuming from: Endpoint[file://src/sap-netweaver?fileName=command.txt&noop=true]
[pache.camel.spring.Main.main()] SpringCamelContext INFO Total 1 routes, of which 1 is started.
[pache.camel.spring.Main.main()] SpringCamelContext INFO Apache Camel 2.12.0.redhat-610-SNAPSHOT (CamelContext: camel-1) started in 0.572 seconds
[ #0 - file://src/sap-netweaver] AuthChallengeProcessor INFO Basic authentication scheme selected
[ #0 - file://src/sap-netweaver] response INFO Exchange[ExchangePattern: InOnly, BodyType: String, Body: <?xml version="1.0" encoding="utf-8"?><entry xml:base="https://sapes1.sapdevcenter.com:443/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><id>https://sapes1.sapdevcenter.com:443/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/FlightCollection(carrid='AA',connid='0017',fldate=datetime'2013-05-01T00%3A00%3A00')</id><title type="text">FlightCollection(carrid='AA',connid='0017',fldate=datetime'2013-05-01T00%3A00%3A00')</title><updated>2013-10-23T15:58:27Z</updated><category term="RMTSAMPLEFLIGHT.Flight" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="FlightCollection(carrid='AA',connid='0017',fldate=datetime'2013-05-01T00%3A00%3A00')" rel="edit" title="Flight"/><link href="FlightCollection(carrid='AA',connid='0017',fldate=datetime'2013-05-01T00%3A00%3A00')/flightbooking" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/flightbooking" type="application/atom+xml;type=entry" title="flightbooking"/><link href="FlightCollection(carrid='AA',connid='0017',fldate=datetime'2013-05-01T00%3A00%3A00')/flightBookings" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/flightBookings" type="application/atom+xml;type=feed" title="flightBookings"/><link href="FlightCollection(carrid='AA',connid='0017',fldate=datetime'2013-05-01T00%3A00%3A00')/FlightCarrier" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FlightCarrier" type="application/atom+xml;type=entry" title="FlightCarrier"/><content type="application/xml"><m:properties><d:flightDetails m:type="RMTSAMPLEFLIGHT.FlightDetails"><d:countryFrom>US</d:countryFrom><d:cityFrom>new york</d:cityFrom><d:airportFrom>JFK</d:airportFrom><d:countryTo>US</d:countryTo><d:cityTo>SAN FRANCISCO</d:cityTo><d:airportTo>SFO</d:airportTo><d:flightTime>361</d:flightTime><d:departureTime>PT11H00M00S</d:departureTime><d:arrivalTime>PT14H01M00S</d:arrivalTime><d:distance>2572.0000</d:distance><d:distanceUnit>SMI</d:distanceUnit><d:flightType/><d:period>0</d:period></d:flightDetails><d:carrid>AA</d:carrid><d:connid>0017</d:connid><d:fldate>2013-05-01T00:00:00</d:fldate><d:PRICE>422.94</d:PRICE><d:CURRENCY>USD</d:CURRENCY><d:PLANETYPE>747-400</d:PLANETYPE><d:SEATSMAX>385</d:SEATSMAX><d:SEATSOCC>372</d:SEATSOCC><d:PAYMENTSUM>191604.78</d:PAYMENTSUM><d:SEATSMAX_B>31</d:SEATSMAX_B><d:SEATSOCC_B>31</d:SEATSOCC_B><d:SEATSMAX_F>21</d:SEATSMAX_F><d:SEATSOCC_F>19</d:SEATSOCC_F></m:properties></content></entry>]