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 6779855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:26:14+00:00 2026-05-26T16:26:14+00:00

To set the name of an XML element I use annotations like this: @XmlElement(name

  • 0

To set the name of an XML element I use annotations like this:

@XmlElement(name = "customer_id")
public String getId(){}

I have to communicate with two different webservices. One expacts an id element named customer_id but the other expacts the id element to be named id. I solved the problem by creating a second Customer class with the same attributes. The only different is that it uses the following annotation

@XmlElement(name = "id")
public String getId(){}

and it has a copy constructor which copies all attributes from Customer1 to Customer2. When I am communicating with the first webservice I send a Customer1 object and the other webservice gets a Customer2 object.

Is there any possibility to use only one Customer object, but rename the id attribute to whatever the webservice expects?

  • 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-26T16:26:14+00:00Added an answer on May 26, 2026 at 4:26 pm

    Note: I’m the EclipseLink JAXB (MOXy) lead and a member of the JAXB 2 (JSR-222) expert group.

    You can use the external mapping document extension in MOXy JAXB to apply a second mapping to your object model. This mapping document can be be used to modify metadata provided via annotations, or completely replace it.

    • http://blog.bdoughan.com/2010/12/extending-jaxb-representing-annotations.html

    For a Detailed Example

    In the example below a single object model is mapped to the results of the Google and Yahoo weather APIs:

    • http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have one xml like, Declare @xmldata xml; set @xmldata =' <Customers> <Id>1</Id> <Name>foo</Name>
I have an XML structure like this: <?xml version=1.0 encoding=utf-8?> <categories version=2.0> <category> <name>cat1</name>
I need to have MySQL query like this one: UPDATE table_name SET 1 =
I have a XML document, element <elementName> in it and hierarchy set in WSDL
I have a struct more or less like this: [Serializable] [XmlRoot(Customer)] public struct TCustomer
I have a class: public class Car { public string Model {get;set;} public string
I'm trying to set key name in a hash to a string containig /
Django tutorials everywhere use constant-set application name all around - in urls file, in
I have the following PowerShell loop: Set-Variable -Name YELLOW -Option ReadOnly -Value 0 Set-Variable
The update statement is like this UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value However

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.