Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-8545

Allow camel-swagger component to run in an internal container

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.14.1
    • Fix Version/s: 2.16.0
    • Component/s: camel-swagger, rest
    • Labels:
      None
    • Environment:

      All

    • Estimated Complexity:
      Unknown

      Description

      I use camel as a front end to provide a RESTful API in front of a mix of various web services. Requests come in in either xml or json, and are converted to xml, transformed and sent on to the back end services which only support an RPC style.

      I use rest dsl with configuration via spring xml, and it runs in a java process.

        <restConfiguration bindingMode="auto" component="jetty" host="localhost" port="18910"/>
      

      I would love to use the camel-swagger component to provide a live API document of the Rest API's configured, but it seems that it is not possible without configuring a web.xml file.

      Is this feasible? Is there an alternative to document the Rest API the camel context provides?

      Camel-context below.

      <beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:camel="http://camel.apache.org/schema/spring"
             xmlns:cxf="http://camel.apache.org/schema/cxf"
             xmlns:context="http://www.springframework.org/schema/context"
             xsi:schemaLocation="
             http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
             http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.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">
                        
        <import resource="classpath:META-INF/spring/jolokia.xml"/>    
                                                                   
        <bean id="metricsRoutePolicyFactory" class="org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory"/>
      
        <camelContext xmlns="http://camel.apache.org/schema/spring">
      
          <properties>
              <property key="CamelLogDebugBodyStreams" value="true"/>
         </properties>
          <propertyPlaceholder location="classpath:incident.properties,file:target/custom.properties" id="properties"/>
          
      	<endpoint uri="jetty:http://localhost:28950/ig?bridgeEndpoint=true" id="jsonEndpoint"/>
      	<endpoint uri="cxf:http://localhost:28960/ig?dataFormat=PAYLOAD&amp;wsdlURL=http://localhost:28960/ig?WSDL&amp;loggingFeatureEnabled=true" id="soapEndpoint"/>         
      	<dataFormats>
          		<xmljson id="xmljson" forceTopLevelObject="true" removeNamespacePrefixes="true"/>
          		<xmljson id="xmljsonWithOptions" trimSpaces="true" skipNamespaces="true"
                   removeNamespacePrefixes="true"/>
      	</dataFormats>
          <restConfiguration bindingMode="auto" component="jetty" host="localhost" port="18910"/>
      
        <rest path="/SubscriberProfilesJson/" consumes="application/json">
          <get uri="/{SubscriberId}">
            <to uri="direct:GetProfileJson"/>
          </get>
          <post uri="/{SubscriberId}/Subscriptions" consumes="application/json">
            <to uri="direct:CreateSubscriptionJson"/>
          </post>
          <get uri="/{SubscriberId}/Subscriptions" consumes="application/json">
            <to uri="direct:GetSubscriptionsJson"/>
          </get>
        </rest>
        
        <rest path="/SubscriberProfilesXml/" consumes="application/xml">
          <get uri="/{SubscriberId}">
            <to uri="direct:GetProfile"/>
          </get>
          <get uri="/{SubscriberId}/Subscriptions" consumes="application/xml">
            <to uri="direct:GetSubscriptions"/>
          </get>
          <post uri="/{SubscriberId}/Subscriptions" consumes="application/xml">
            <to uri="direct:CreateSubscription"/>
          </post>
        </rest>
        
        <rest path="/SubscriberProfilesJsonConvert/" consumes="application/json">
          <get uri="/{SubscriberId}/Subscriptions" consumes="application/json">
            <to uri="direct:GetSubscriptionsJsonConvert"/>
          </get>
        </rest>
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              karlopenet Karl Openet
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: