简体   繁体   English

使用自上而下的方法在Web服务中返回java.util.List

[英]return java.util.List in webservice using top down approach

I'm trying to implement a simple java webservice in top down approach using Apache Axis2. 我正在尝试使用Apache Axis2以自顶向下的方法实现一个简单的Java Web服务。 This webservice shall send list of values as output. 该Web服务将发送值列表作为输出。

When I tried to configure java.util.List as response output, I did not find any mapping with xml types for this java collection. 当我尝试将java.util.List配置为响应输出时,没有为此Java集合找到任何具有xml类型的映射。

How do we setup java collection(List) type to return as output. 我们如何设置java collection(List)类型以返回为输出。 I'm looking to get some help to resolve this issue. 我希望获得一些帮助来解决此问题。

Thanks! 谢谢!

Standard SOAP does NOT know about Java objects, it only knows about variables such as strings, numbers, etc. 标准SOAP不了解Java对象,仅了解诸如字符串,数字等变量。

If you really need to send Java objects, you could serialize them to an object stream and send the resulting binary as a SOAP attachment. 如果确实需要发送Java对象,则可以将它们序列化为对象流,然后将结果二进制文件作为SOAP附件发送。 See SAAJ - the SOAP with Attachments API for Java. 请参阅SAAJ-Java的带有附件的SOAP API。 This of course would require that your client side have access to the 3rd party library as well as your own custom class library. 当然,这将要求您的客户端有权访问第三方库以及您自己的自定义类库。

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

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