2 Replies Latest reply on Oct 6, 2016 8:21 PM by Gavin McGibbon

    Using JBDS to generate a REST front end that drives a remote SOAP

    Har Puri Newbie

      For a final implementation in Fabric8, I need to create a local REST front end that drives a remote SOAP endpoint

      Example remote service - I am using http://www.webservicex.net/airport.asmx?wsdl with the operation getAirportInformationByAirportCode  which takes a string airport code e.g. "TPA" or "ORD" and returns a string XML fragment .

      Using the service only because it is simple, works, and has no security. I will layer in digital signatures later.

       

      Looking at the standard Fuse examples I got thoroughly confused between blueprint.xml, spring and CXF. I am hoping to create a sequence of steps for JBDS that will allow less technical users to create the proxy.

      I started with Red Hat JBoss Developer Studio Version: 10.1.0.GA Build id: GA-v20160902-1725-B43 Build date: 20160902-1725

      I don't know if that one is buggy (please advise if I should switch to a lower version e.g. 9 or 8)

       

      I created a new Fuse project with archetype camel-archetype-cxf-contract-first-blueprint

      removed the code and wsdl and placed the new wsdl, and updated the pom.xml

      observed the web service code generated in the package name derived from the wsdl = net.webservicex.*

      I wrote a small test program that spits out the return to test the generated code works.

      public static void main(String[] args) {
         Airport aa = new Airport(); //SEI
         AirportSoap as= aa.getAirportSoap12(); //port
         String resp =as.getAirportInformationByAirportCode("TPA");
         System.out.println(resp);

          }

       

      this works and returns

      <NewDataSet>

        <Table>

          <AirportCode>TPA</AirportCode>

          <CityOrAirportName>TAMPA TAMPA</CityOrAirportName>

          <Country>United States</Country>

          <CountryAbbrviation>US</CountryAbbrviation>

          <CountryCode>33</CountryCode>

      ::::::::::::::::::::::::::::::::::::::

       

      Now back to the blueprint. Seems like they got rid of the CXF endpoints in the palette for the design view so I added it in by hand but I am unsure how to set this up as a route. Looking at the example in  Fuse ESB Enterprise - Web Services and Routing with Camel CXF - Instantiate the WS Client Proxy i sought to use the same timer based client invoker as a first step but this did not work

       

      <?xml version="1.0" encoding="UTF-8"?>

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

          xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"

          xmlns:jaxws="http://cxf.apache.org/jaxws"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd                   http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd                  http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd                  http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">

          <jaxws:client address="http://www.webservicex.net/airport.asmx"

              id="airportServiceProxy" serviceClass="net.webserviceex.Airport"/>

          <bean class="com.avalon.cdm.fuse.mlb.ClientInvoker"

              destroy-method="destroy" id="airportServiceClient" init-method="init">

              <property name="airportService" ref="airportServiceProxy"/>

          </bean>

          <cxf:cxfEndpoint address="/airport/" id="WSfront"

              serviceClass="net.webservicex.Airport" wsdlURL="wsdl/airport.wsdl"/>

          <cxf:cxfEndpoint address="/airport/" id="WSreal"

              serviceClass="net.webservicex.Airport" wsdlURL="wsdl/airport.wsdl"/>

          <camelContext id="camelContext-a02f90ab-413d-4513-8ccf-13ada3de22fb" xmlns="http://camel.apache.org/schema/blueprint">

              <route id="_route1">

                  <from id="WS" uri="cxf:beanId:WSfront"/>

                  <log id="_log1" message="Message received = ${body}"/>

                  <to id="WSreal" uri="cxf:beanId:airportServiceProxy"/>

              </route>

          </camelContext>

      </blueprint>

       

       

      Any examples, clues or advice on alternate approaches greatly appreciated ,

      Thanks