Skip to main content Skip to complementary content

Configuring the components

Procedure

  1. In the Basic settings view of the cTimer component, enter 1 in the Repeat field to trigger the message exchange one time.
  2. In the Basic settings view of the cSetHeader component, click the [+] button to add two headers in the Headers table, and then give each header a name and a value.
    In this example, name the first header "Authorization" and give its value an email address.
    The other header is org.apache.camel.component.cxf.common.message.CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS. Set it value to String.class to turn the response object to string.
  3. In the Basic settings view of the cSetBody component:
    1. Select SIMPLE from the Language list to trigger a simple text message exchange in this example.
    2. In the Expression field, enter {\"user\":\"test\",\"password\":\"t@l3nd\}" in double quotation marks as the content of the message.
  4. In the Basic settings view of the first cLog component, click Specify output log message in the Options area and enter "Test.cLog_1 HEADER ${in.headers} BODY ${in.body} " in the message field to log the message header and body.
  5. In the Basic settings view of the cREST component:
    1. Fill the Endpoint field with the URL of the Web service you are going to invoke.
    2. From the Type list, select Manual to determine the REST API mapping manually.
    3. In the Relative Path field, enter constant("").
    4. Select POST in the HTTP Method list.
    5. Select JSON in the Content Type and Accept Type lists.
    6. In the Response Class field, enter javax.ws.rs.core.Response.
  6. In the Basic settings view of the second cLog component, select Specify output log messge in the Options area and enter "Test.cLog_2 HEADER ${in.headers} BODY ${in.body} Exception ${exception.message}" in the message field to log the header and body of the response message and the exception.
  7. Press Ctrl+S to save your Route.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!