Eclipse @在生成WSDL-Axis2 WS时忽略XmlTransient
我有课Eclipse @在生成WSDL-Axis2 WS时忽略XmlTransient,eclipse,web-services,wsdl,axis2,xmltransient,Eclipse,Web Services,Wsdl,Axis2,Xmltransient,我有课 public class Calculator { public Test getTest(){ return new Test(); } } 我想将其公开为Web服务。测试定义为: public class Test { private Test2[] tests; @XmlTransient public Test2[] getTests() { return tests; } public v
public class Calculator {
public Test getTest(){
return new Test();
}
}
我想将其公开为Web服务。测试定义为:
public class Test {
private Test2[] tests;
@XmlTransient
public Test2[] getTests() {
return tests;
}
public void setTests(Test2[] tests) {
this.tests = tests;
}
}
现在,在Test2[]测试中添加@XmlTransient注释,我希望它不会列在生成的WSDL中(我使用的是Eclipse,所以右键单击Calculator>Web Services>Generate Web Service),但我错了:
...
<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>
...
。。。
...
...
如您所见,测试仍然存在于WSDL中(第5行)。
如果有用的话,我将使用Axis2,EclipseIndigo。这仍然是一个问题,但我找到了一个解决方法。我在我的services.xml中添加了:
<parameter name="beanPropertyRules">
<bean class="package.Test" excludeProperties="tests" />
</parameter>
即:
<bean class="package.Object" excludeProperties="propertyToExcludeFromWSDL" />
这起作用了