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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:01:52+00:00 2026-06-09T12:01:52+00:00

I fired up my WebServicesExplorer in my Eclipse recently and I just realized that

  • 0

I fired up my WebServicesExplorer in my Eclipse recently and I just realized that the xs:element names generated by JAXB are not so verbose. Here is one of the sequences:

<xs:sequence>
  <xs:element minOccurs="0" name="arg0" type="xs:string" /> 
  <xs:element minOccurs="0" name="arg1" type="xs:string" /> 
  <xs:element name="arg2" type="xs:int" /> 
</xs:sequence>

generated from this file:

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class User {
    private String firstName;
    private String lastName;
    private int age;

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

I’m not a JAXB expert yet, so I was wondering whether I can change those arg* named elements into something sensible, like in the POJO class?

  • 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-06-09T12:01:53+00:00Added an answer on June 9, 2026 at 12:01 pm

    You do not mention what web service framework you are using but the behaviour sounds similar to the JAX-WS specs, e.g. The parts in my generated wsdl have names of the form “arg0”, “arg1”, … Why don’t the parts (and Java generated from them) use the nice parameter names I typed into the interface definition?

    Official answer: The JAX-WS spec (specifically section 3.6.1) mandates that it be generated this way. To customize the name, you have to use an @WebParam(name = “blah”) annotation to specify better names. (You can use @WebResult for the return value, but you’ll only see the results if you look at the XML.)

    Reason: One of the mysteries of java is that abstract methods (and thus interface methods) do NOT get their parameter names compiled into them even with debug info. Thus, when the service model is built from an interface, there is no way to determine the names that were using in the original code.

    If the service is built from a concrete class (instead of an interface) AND the class was compiled with debug info, we can get the parameter names. The simple frontend does this. However, this could cause potential problems. For example, when you go from developement to production, you may turn off debug information (remove -g from javac flags) and suddenly the application may break since the generated wsdl (and thus expect soap messages) would change. Thus, the JAX-WS spec writers went the safe route and mandate that you have to use the @WebParam annotations to specify the more descriptive names.

    You could try adding an XmlElement annotation to each field and specify a name, but are you sure this is caused by JAXB? If I run schemagen with your POJO code this is what I get (the names are picked up correctly):

    <xs:complexType name="user">
        <xs:sequence>
          <xs:element name="age" type="xs:int"/>
          <xs:element name="firstName" type="xs:string" minOccurs="0"/>
          <xs:element name="lastName" type="xs:string" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    

    Based on your comment, if you “force” your POJO to the following code, do you still get complaints about duplicate names?

    import javax.xml.bind.annotation.XmlRootElement;
    import javax.xml.bind.annotation.XmlAccessorType;
    import javax.xml.bind.annotation.XmlElement;
    import javax.xml.bind.annotation.XmlAccessType;
    
    @XmlAccessorType(XmlAccessType.NONE)
    @XmlRootElement
    public class User {
        @XmlElement(name = "firstName")
        private String firstName;
    
        @XmlElement(name = "lastName")
        private String lastName;
    
        @XmlElement(name = "age")
        private int age;
    
        public String getFirstName() {
            return firstName;
        }
    
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        }
    
        public String getLastName() {
            return lastName;
        }
    
        public void setLastName(String lastName) {
            this.lastName = lastName;
        }
    
        public int getAge() {
            return age;
        }
    
        public void setAge(int age) {
            this.age = age;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that mouseup events are only fired when they are not in conjunction
Is there an event that gets fired when one clicks the ColumnHeader of a
By experiment I found that Resize event is fired when Move is performed. Not
Possible Duplicate: Getting the ID of the element that fired an event using JQuery
I fired up a sample application that uses Amazon S3 for image hosting. I
Is there any event that is fired when the idHttpServer disconnects? By disconnect I
Are there any events fired by an element to check whether a css3 transition
I just fired up totalview on my hello world application (c++) and i only
Is there an intent that is fired when a user unlocks their screen? I
I recently got bored and fired up my old Mac OS Classic emulator, and

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.