Question

I've got a class

public class Calculator {
    public Test getTest(){
        return new Test();
    }
}

That I want to expose as Web Service. The Test definition is:

public class Test {
    private Test2[] tests;
    @XmlTransient
    public Test2[] getTests() {
        return tests;
    }
    public void setTests(Test2[] tests) {
        this.tests = tests;
    }
}

Now, adding @XmlTransient annotation at Test2[] tests, I'm expecting it to not to be listed in the generated WSDL (I'm using Eclipse, so right click on Calculator > Web Services > Generate Web Service), but I'm not right:

...
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="...">
<xs:complexType name="Test">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="tests" nillable="true" type="ax21:Test2"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Test2">
<xs:sequence/>
</xs:complexType>
</xs:schema>
...
</wsdl:types>
...

As you can see, tests is still present in the WSDL (5th row). If useful, I'm using Axis2, Eclipse Indigo.

Was it helpful?

Solution

This is still a problem, but I found a workaround. I added to my services.xml:

    <parameter name="beanPropertyRules">
        <bean class="package.Test" excludeProperties="tests" />
    </parameter>

That is:

 <bean class="package.Object" excludeProperties="propertyToExcludeFromWSDL" />

This worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top