简体   繁体   中英

Abstract types in webservice definition (wsdl)

I'm using the framework xFire to publish a webservice in my web application. In this service I use abstract return types in the operations like List<GlobaleType>. The operations concrete return values are ArrayList<SpecialType>.

The concrete class SpecialType extends the abstract class GlobaleType. In the generated WSDL document only GlobaleType is given, with the additional definition, abstract="true". A generated client (with the help of apache axis) creates only an abstract class GlobaleType which can't be used for instantiation.

Has someone an idea why the wsdl contract is wrong?

If I understand you correctly, your web method signature is:

public List<GlobaleType> doSomething(args)

Then your wsdl is being generated correctly. As long as apache axis knows that the SpecialType extends hte GlobalType, then the final type can be sent across the webservice and the polymorphism will be transfered from the web service to the client.

Are you using a JAX-WS web service? Then make sure that you use the @XmlSeeAlso annotation on your base type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM