Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7615177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:35:02+00:00 2026-05-31T02:35:02+00:00

during my Camel routes, I query a server (a HTTP GET) and as a

  • 0

during my Camel routes, I query a server (a HTTP GET) and as a result, I receive a 200 OK with a XML body looking similar like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<userProfiles xmlns="http://www.mycompany.com/AEContext/xmldata">
  <userProfile name="guest">
    <userProfileAttributes>
      <userProfileAttribute name="parameter1" value="data1" nameVisibility="ALL"/>  
      <userProfileAttribute name="parameter2" value="data2" nameVisibility="ALL"/>
      <userProfileAttribute name="parameter3" value="data3" nameVisibility="ALL"/>
    </userProfileAttributes>
  </userProfile>
</userProfiles>

Any idea how I would be able to get the value of “parameter2” in the XML part (in my example ‘data2’) and store that value in an exchange property ? I guess by using an xpath expression ? Or …
Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:35:02+00:00Added an answer on May 31, 2026 at 2:35 am

    An easy way to retrieve the value would be to use the XPath Language. It will allow you to extract the data you want and set it somewhere (header, body , …). Here is how to set a parameter2 header with the value:

    <setHeader headerName="parameter2">
      <xpath resultType="java.lang.String">
        /userProfiles/userProfile/userProfileAttributes/userProfileAttribute[2]/@value
      </xpath>
    </setHeader>
    

    Using Java DSL

    An example using the Java DSL and setting the message body:

    final Namespaces ns = new Namespaces("c", "http://www.mycompany.com/AEContext/xmldata");
    
    // existing code
    from(...)
      .setBody(
        ns.xpath(
          "/c:userProfiles/userProfile/userProfileAttributes/userProfileAttribute[2]/@value",   
          String.class)
       )
       .to(...);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Camel Route Definition written in Java DSL like this: from(myEndpoint) .throttle(200)
I'm currently stress testing my server. sometimes I get A non-recoverable error occurred during
During my work with databases I noticed that I write query strings and in
I'm trying to install R and came across this error during installation: http://projects.uabgrid.uab.edu/r-group/wiki/install-R ,
I want to start Camel and ActiveMQ during boot when I start karaf, What
I'd like to use a dependency injection framework . During my evaluation I came
I'm writing a TCP server that functions very much like a chatroom and came
The question posed came about during a 2nd Year Comp Science lecture while discussing
During navigation of the java.lang.reflect.Method class I came across the method isBridge . Its
During a discussion about security, a developer on my team asked if there was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.