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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:34:28+00:00 2026-06-10T14:34:28+00:00

I have a WSDL file which is from an Axis2 Web Service. When I

  • 0

I have a WSDL file which is from an Axis2 Web Service. When I generate a client stub using wsimport given the WSDL file, the resulting classes require JAXBElement paramaters. Why is it like that?

Sample Method from one of the Generated Classes:

JAXBElement<DataBean> value;

public void setValue(JAXBElement<DataBean> value)
{
    this.value = ((JAXBElement<DataBean>) value);
}

I am expecting it to look like this (without the JAXBElement):

DataBean value;

public void setValue(DataBean value)
{
    this.value= (DataBean) value;
}

The tutorials I saw on the net does not set the classes to JAXBElement. What could be the problem? Please take note that the server is an Axis2 web service and the WSDL file is auto-generated by Axis2. The assumption is I have no control over the server.

How can I make it in such a way that wsimport won’t convert the parameters to JAXBElements?

Below is an excerpt from the WSDL file: (I ignored some of the tags to include only the essential tags)

<xs:element name="getData">
    <xs:complexType>
        <xs:sequence>
            <xs:element minOccurs="0" name="getData" nillable="true" type="ax220:getData"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:complexType name="getData">
    <xs:sequence>
        <xs:element minOccurs="0" name="value" nillable="true" type="ax219:DataBean"/>
    </xs:sequence>
</xs:complexType>

<wsdl:message name="getDataRequest">
    <wsdl:part name="parameters" element="ns:getData"/>
</wsdl:message>

<wsdl:message name="getDataResponse">
    <wsdl:part name="parameters" element="ns:getDataResponse"/>
</wsdl:message>

<wsdl:operation name="getData">
    <wsdl:input message="ns:getDataRequest" wsaw:Action="urn:getData"/>
    <wsdl:output message="ns:getDataResponse" wsaw:Action="urn:getDataResponse"/>
</wsdl:operation>

<wsdl:operation name="getData">
    <soap:operation soapAction="urn:getData" style="document"/>
    <wsdl:input>
        <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
        <soap:body use="literal"/>
    </wsdl:output>
</wsdl:operation>

<wsdl:operation name="getData">
    <soap12:operation soapAction="urn:getData" style="document"/>
    <wsdl:input>
        <soap12:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
        <soap12:body use="literal"/>
    </wsdl:output>
</wsdl:operation>

<wsdl:operation name="getData">
    <http:operation location="getData"/>
    <wsdl:input>
        <mime:content type="text/xml" part="parameters"/>
    </wsdl:input>
    <wsdl:output>
        <mime:content type="text/xml" part="parameters"/>
    </wsdl:output>
</wsdl:operation>
  • 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-10T14:34:29+00:00Added an answer on June 10, 2026 at 2:34 pm

    To begin with: I don’t think this can be done. That is, I don’t think you can tell wsimport to generate the classes differently. However, I can tell you how to modify the WSDL in a way that generates the schema differently and that could still enable you to talk to the service.

    I took the type definitions from the WSDL, adjusted the name of the complexType and added the a type for DataBean that was missing above. I pasted that to a schema and compiled the schema with xjc, the JAXB schema compiler, which is used by wsimport to generate classes from the type defintions. Here is the schema:

    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/DataBean"
        xmlns:tns="http://www.example.org/DataBean" elementFormDefault="qualified"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
    
        <xs:element name="getData">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="0" name="getDataType" type="tns:getDataType" />
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    
        <xs:complexType name="getDataType">
            <xs:sequence>
                <xs:element minOccurs="0" name="value" type="tns:DataBean" />
            </xs:sequence>
        </xs:complexType>
    
        <xs:complexType name="DataBean">
            <xs:simpleContent>
                <xs:extension base="xs:int" />
            </xs:simpleContent>
        </xs:complexType>
    </schema>
    

    You don’t need any special options for the compiler, simply execute xjc and point it to the schema file, then it will compile the source files.

    The generated classes do not use JAXBElement as method parameters. That is they look like that:

    protected DataBean value;
    
    public DataBean getValue() {
        return value;
    }
    

    Why is this? I removed the nillable="true" attributes from the element defintions and this did the trick. nillable="true" states that explicit null values are legal here:

    <DataBean></DataBean> 
    

    If you remove this attribute, your code will run into problems if the service actually writes null values in there. But after all the WSDL is generated and maybe Axis2 just thinks the nillable should be in there for some reason, although the implementation never actually uses it. If you are lucky, it does not and everything will work fine, although you modified the WSDL.

    I hope this helps! If not, then at least I have learned something today 😉

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

Sidebar

Related Questions

i have local WSDL file. i tried to create JAX-WS Web service client which
I have two project, one which generates some artifacts from a WSDL file using
I have a WSDL 1.1 file which describes my Web Service. Now I need
I have a asynchronous web service using axis2 which I call two different times
I have a JAX-WS-driven web service whose WSDL we generate a web service client
I'm implementing SOAP client to existing service of which i have WSDL file. I
I have been given a WSDL file and I need to consume a web
I have an WSDL / Web Service and I need to generate an set
I have a pom file which is generating source from WSDL files which is
I have generated a class using wsdl.exe from the wsdl file. I inspected the

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.