Hi Bob,

Could you try setting:

<setHeader headerName="CamelHttpBaseUri">
  <constant>http://xx.xxx.xxx.x/myhttpapp-1
<http://xx.xxx.xxx.x/myhttpapp-1/httpListener?bridgeEndpoint=true&amp;throwExceptionOnFailure=false>
</constant>
</setHeader>

before you make the outgoing HTTP call.

Cheers,
Richard


On Mon, Jan 25, 2016 at 9:33 PM, bob anderson <bob.anderson2...@gmail.com>
wrote:

> I am trying to use a Rest consumer and then an HTTP Producer in the same
> camel context. Both the Rest consumer works and the HTTP producer work
> separately but not in the same context. The HTTP app that is called is just
> another Camel servlet app that listens and returns an xml body message. I
> get a 404 service not found error. I am probably not understanding some
> concept about in and out bound HTTP
> I have tried in two different Tomcat webservers (v6 and v7), putting the
> http app on different and the same webservers.  I am running camel version
> 2.15.1 - I have written this in the spring dsl as follows;
>
> <camelContext xmlns="http://camel.apache.org/schema/spring";>
>      <!-- not sure if this is needed as the input from the rest call seems
> to be a java.lang.hasmap - which I now handle as a hashmap not as json -->
>         <dataFormats>
>           <xmljson id="xmljson" />
>         </dataFormats>
>   <!-- configure rest to use the camel-servlet component, and use json
> binding mode -->
>      <restConfiguration component="servlet" bindingMode="json"
> contextPath="session" port="8080">
>       <dataFormatProperty key="prettyPrint" value="true"/>
>     </restConfiguration>
> <!-- set up the listening paths that the service will accept  -->
>
>     <rest path="/session" consumes="application/json"
> produces="application/json">
>     <!-- ********************************** R E S T
> *************************************-->
>       <post uri="/{sessionid}/start" >
>          <to uri="direct:start"/>
>       </post>
>       <!-- ********************************** R E S T
> *************************************-->
>     </rest>
>
>     <route streamCache="true">
>        <from uri="direct:start"/>
>        <!-- Unpack the body of the message into header fields -->
>        <to uri="direct:mapStartMsg"/>
>        <!-- Create XML body message for HTTP request -->
>        <to uri="direct:createHTTPRequestMsg"/>
>      <!-- The HTTP method for the HTTP app is POST so I've hard coded it
> here even though with content in the body it shouldnt be necessary -->
>       <setHeader headerName="CamelHttpMethod">
>         <constant>POST</constant>
>       </setHeader>
>       <!--
>
> ******************************************************************************************
> -->
>       <!-- U R L     I S    H A R D    C O D E D     H E R
> E                                           -->
>      <!-- I have tried adding the port to the url, as well as using HTTP4,
> as well as using -->
>       <!-- a recipient list to call the URI
>                                      -->
>         <!--
>
> ******************************************************************************************
> -->
>       <to uri="
>
> http://xx.xxx.xxx.x/myhttpapp-1/httpListener?bridgeEndpoint=true&amp;throwExceptionOnFailure=false
> "/>
>         <!-- Get the HTTP response code from http server -to test for
> success or fail -->
>          <setHeader headerName="Response">
>              <simple resultType="java.lang.String">${body}</simple>
>         </setHeader>
>         <setHeader headerName="HttpResponseCode">
>              <simple
> resultType="java.lang.Integer">${header.CamelHttpResponseCode}</simple>
>         </setHeader>
>
>         <log message=" ** CALLED THE HTTP app response body = ${body}"/>
>
>          </route>
>
>
> --
>

Reply via email to