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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:27:13+00:00 2026-05-28T13:27:13+00:00

I am consuming a webservice using my java web application.This returns a number of

  • 0

I am consuming a webservice using my java web application.This returns a number of data among which there is a attribute named Consumer. This is represented as an object when the WSDL is converted to Java code. There is only one string variable id inside this class. There is another class Person which extends Consumer. This has a number fields like firstName , lastName etc. In the JSF code , there is a reference to consumer.firstName and the value pertaining to firstName is being printed properly when person object is returned as part of response xml. This confuses me a bit because consumer object does not contain firstName and still the value is getting printed properly when consumer.firstName is used. Please can you help me in understanding this.

JSF Code

<h:outputText value="#{myBean.consumer.firstName}" />

Backing Bean

public Consumer getConsumer() {
  return consumer;
}

Consumer Class

public class Consumer implements java.io.Serializable {

  private java.lang.String id;

  public java.lang.String getId() {
    return this.id;
  }

  public void setId(java.lang.String id) {
    this.id = id;
  }

}

Person Class

public class Person extends Consumer {
     private String firstName;
     private String lastName;
     private String dateOfBirth;

     // Getters and Setters
}
  • 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-28T13:27:14+00:00Added an answer on May 28, 2026 at 1:27 pm

    JSF uses reflection to call the methods on your objects. It doesn’t know what the type of myBean.consumer is. All it knows is that you asked the firstName of this object. So, what it does is

    1. Find an attribute, in any scope, named myBean
    2. if not null, find if there is a public no-arg method named “getConsumer” in the class (or any superclass or interface) of this object
    3. Call this method, and get the result: another object
    4. if this other object is not null, find if there is a public no-arg method named “getFirstName” in the class (or any superclass or interface) of this other object
    5. Call this method

    So, even if the method getConsumer() declares that it returns a Consumer, if, at runtime, the actual object returned by getConsumer() is a Person, JSF will search for a getFirstName() method in Person, it will find it, and will happily call it and outut its result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw this post on consuming a web service using CURL: Consume WebService with
I'm consuming a web service using a stand-alone VBScript. The web service returns to
I am consuming an external C# Web Service method which returns a simple calculation
I am consuming a webservice (written in java) - that basically returns a byte[]
I am consuming a web service which has a number of methods (50) which
I'm consuming a webservice from my application in C# .net (2.0) that return values
I have some code I've written in PHP for consuming our simple webservice, which
I'm consuming a third party .NET WebService in my client application. For debugging purposes
I have a WCF web service using wsHttpBinding that I am consuming from a
I'm trying to write a web service client in c# which the webservice is

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.