简体   繁体   English

Web服务定义(wsdl)中的抽象类型

[英]Abstract types in webservice definition (wsdl)

I'm using the framework xFire to publish a webservice in my web application. 我正在使用xFire框架在Web应用程序中发布Web服务。 In this service I use abstract return types in the operations like List<GlobaleType>. 在此服务中,我在List <GlobaleType>之类的操作中使用抽象返回类型。 The operations concrete return values are ArrayList<SpecialType>. 操作的具体返回值为ArrayList <SpecialType>。

The concrete class SpecialType extends the abstract class GlobaleType. 具体类SpecialType扩展了抽象类GlobaleType。 In the generated WSDL document only GlobaleType is given, with the additional definition, abstract="true". 在生成的WSDL文档中,仅给出了GlobaleType以及附加定义abstract =“ true”。 A generated client (with the help of apache axis) creates only an abstract class GlobaleType which can't be used for instantiation. 生成的客户端(借助apache轴)仅创建一个抽象类GlobaleType,该类不能用于实例化。

Has someone an idea why the wsdl contract is wrong? 有人知道为什么wsdl合同错误吗?

If I understand you correctly, your web method signature is: 如果我对您的理解正确,则您的网络方法签名为:

public List<GlobaleType> doSomething(args)

Then your wsdl is being generated correctly. 然后您的wsdl会正确生成。 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. 只要apache axis知道SpecialType扩展了GlobalType,那么最终类型就可以在Web服务上发送,并且多态性将从Web服务传输到客户端。

Are you using a JAX-WS web service? 您是否正在使用JAX-WS Web服务? Then make sure that you use the @XmlSeeAlso annotation on your base type. 然后,确保在基本类型上使用@XmlSeeAlso批注。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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