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

  • Home
  • SEARCH
  • 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 135195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:44:59+00:00 2026-05-11T06:44:59+00:00

I’m using Axis to model a sample WebService. What I’m doing now is trying

  • 0

I’m using Axis to model a sample WebService. What I’m doing now is trying to understand which are the limitations of the automated wsdl and code generation.

Now for some server side code:

this is the skeleton of the sample web service:

public class TestWebService {   public AbstractAttribute[] testCall( AbstractAttribute someAttribute ) {     .... 

and my data classes: public abstract class AbstractAttribute { String name;

  /*get/set for name*/   public abstract T getValue();   public abstract void setValue(T value); }  public class IntAttribute extends AbstractAttribute<Integer> {   Integer value;   public Integer getValue(){ return value; }   public void setValue(Integer value){ this.value = value; } }  public class StringAttribute extends AbstractAttribute<String> {   String value;   /* ok, you got the point, get/set for value field */ } 

The eclipse tool for Axis2 is quite happy to generate a wsdl from these sources, including the schema for the attribute classes, which is:

<xs:complexType name='AbstractAttribute'>     <xs:sequence>         <xs:element minOccurs='0' name='name' nillable='true' type='xs:string'/>         <xs:element minOccurs='0' name='value' nillable='true' type='xs:anyType'/>     </xs:sequence> </xs:complexType> <xs:complexType name='IntAttribute'>     <xs:complexContent>         <xs:extension base='xsd:AbstractAttribute'>             <xs:sequence>                 <xs:element minOccurs='0' name='value' nillable='true' type='xs:int'/>             </xs:sequence>         </xs:extension>     </xs:complexContent> </xs:complexType> <xs:complexType name='StringAttribute'>     <xs:complexContent>         <xs:extension base='xsd:AbstractAttribute'>             <xs:sequence>                 <xs:element minOccurs='0' name='value' nillable='true' type='xs:string'/>             </xs:sequence>         </xs:extension>     </xs:complexContent> </xs:complexType> 

now, if see something strange here, AbstractAttribute hasn’t the ** abstract=’true’ ** attribute, and define an anyType value element, which get rewrite in IntAttribute and StirngAttribute. I don’t even know if this is a legal schema (I don’t think it’s legal, by the way).

More, if I try to generate a client from this wsdl (always using the eclipse tools) the generated sources won’t compile, because AbstractAttribute defines an

Object localValue; 

field and Int/String Attribute defines

int localValue; 

and

String localValue; 

..I tried to ‘accomodate’ the sources (without many hopes, obviously), and the results are that the server try to instantiate an AbstractAttribute instance (throwing an InstantiationException).

So my question is: there is a way to model something like the data model above, or web services and XML schemas’ in general are not the best tools to use for this particular case?

  • 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. 2026-05-11T06:45:00+00:00Added an answer on May 11, 2026 at 6:45 am

    To explain the problem you are encountering, it helps to think of what Axis needs to do when your service is called.

    Axis is simply a java web-application…when it receives a request for a service, it will look up the mapping that you’ve defined for it. If it finds a mapping, it tries to create an instance of the necessary classes you’ve defined to service the request.

    If you’ve defined the classes as abstract or as interfaces then you’ll get InstantiationExceptions since these types can’t be created. When Axis tried to create the wsdl, it won’t be able to figure out what type to put so it will use ‘anyType.’

    To answer your question: you CAN use the the model you have above in your code, but you won’t be able to use these classes with Axis. What we have typically done in our projects is:

    1. Define the classes we need, as we would in a typical Object-Oriented application
    2. Define ‘transport-only’ classes that are used for web services. These classes are composed of simple types and can be easily created. They are only used for exchanging web-service messages. We use these classes with Axis.
    3. Find some way for these two types of classes to easily share/exchange information. You can have interfaces that are shared by both (but Axis doesn’t know about) or even use BeanUtils.copyProperites to keep two different objects in sync.

    Hope that answers your question.

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

Sidebar

Ask A Question

Stats

  • Questions 196k
  • Answers 196k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer After doing an awful lot of experiments and trying various… May 12, 2026 at 7:07 pm
  • Editorial Team
    Editorial Team added an answer Oops: Only now did I notice that you are on… May 12, 2026 at 7:07 pm
  • Editorial Team
    Editorial Team added an answer import operator [a for a, b in groupby(thelist, operator.attrgetter('equation')] Btw,… May 12, 2026 at 7:07 pm

Related Questions

In order to apply a triggered animation to all ToolTip s in my app,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.