You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mjelwood <mj...@gmail.com> on 2012/05/24 14:55:59 UTC

Re: XML file posting to Rest Service example

I changed the route up slightly:

<route>
      <from uri="file:\\localhost\FTPLand"/>
      *<convertBodyTo type="String"/>*
      <setHeader headerName="CamelHttpMethod">
            <constant>POST</constant>
      </setHeader>
      <to uri="cxfrs:http://localhost/s/restservice?httpClientAPI=true"
pattern="InOut"/>
      <to uri="log:response"/>
    </route>

Exception received:

org.apache.camel.component.cxf.CxfOperationException: JAXRS operation failed
invoking file://\\localhost\FTPLand\ with statusCode: 307, redirectLocation:
http://localhost/s/restservice/

--
View this message in context: http://camel.465427.n5.nabble.com/XML-file-posting-to-Rest-Service-example-tp5713353p5713491.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: XML file posting to Rest Service example

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 24/05/12 13:55, mjelwood wrote:
> I changed the route up slightly:
>
> <route>
>        <from uri="file:\\localhost\FTPLand"/>
>        *<convertBodyTo type="String"/>*
>        <setHeader headerName="CamelHttpMethod">
>              <constant>POST</constant>
>        </setHeader>
>        <to uri="cxfrs:http://localhost/s/restservice?httpClientAPI=true"
> pattern="InOut"/>
>        <to uri="log:response"/>
>      </route>
>
> Exception received:
>
> org.apache.camel.component.cxf.CxfOperationException: JAXRS operation failed
> invoking file://\\localhost\FTPLand\ with statusCode: 307, redirectLocation:
> http://localhost/s/restservice/
>

I guess the target available at http://localhost/s/restservice requests 
a redirect. It is possible to configure the CXF HTTP conduit to 
auto-redirect, please see
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html, 
'AutoRedirect' property is needed.

Here is some more info on how to make sure the HTTP Conduit config gets 
applied to a given client invocation:

http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringanHTTPConduitfromSpring

Also, I believe Willem did the 'httpClientAPI' set to true by default 
awhile back

HTH, Sergey


> --
> View this message in context: http://camel.465427.n5.nabble.com/XML-file-posting-to-Rest-Service-example-tp5713353p5713491.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com