1 Reply Latest reply on Dec 8, 2014 7:37 AM by shahid.farooq.3551

    REST Full Web Service in Camel Route JBOSS Fuse

    shahid.farooq.3551

      Hi,

      I developed a REST service and declared its endpoint in camelContext file using cxfrs tag. like this

       

      <cxf:rsServer id="ldapServer" address="http://localhost:9090/ldaproute"

        serviceClass="com.saanga.ES.ESB.LDAPTest" />

       

       

        <camelContext trace="false" id="ldapContext" xmlns="http://camel.apache.org/schema/blueprint">

          <route id="ldapRoute">

              <from uri="cxfrs:bean:ldapServer"/>

              <log message="${body}"/>

              <choice>

                  <when>

                      <simple>${in.header.operationName} == 'addUser'</simple>

                      <bean method="addUser" beanType="com.saanga.ES.ESB.LDAPTest"/>

                      <marshal>

                          <json library="Jackson"/>

                      </marshal>

                  </when>

                  <when>

                      <simple>${in.header.operationName} == 'updatePassword'</simple>

                      <bean method="updatePassword" beanType="com.saanga.ES.ESB.LDAPTest"/>

                      <marshal>

                          <json library="Jackson"/>

                      </marshal>

                  </when>

                  <otherwise>

                      <bean method="authenticateUser" beanType="com.saanga.ES.ESB.LDAPTest"/>

                      <marshal>

                          <json library="Jackson"/>

                      </marshal>

                  </otherwise>

              </choice>

          </route>

      </camelContext>

       

      Now if I want to pass multiple values to adduser method like HttpHeaders and post data from client it only takes first parameter and second one is null. Adduser signature is

      @POST
      @Path("/adduser")
      @Produces(MediaType.APPLICATION_JSON)
      @Consumes(MediaType.APPLICATION_JSON)
      public CustomResponseRest addUser(@Context HttpHeaders headers,String data)

       

      can anyone please tell how to pass multiple values from cxfrs to bean processor method. I tested this without camel it works fine but in camel bean method only takes first parameter. I read in manning book about parameter binding for bean but unable to understand how that will work in REST context. Please help.