Axis2 POJO 中参数数量可变

发布于 2024-08-25 10:07:41 字数 769 浏览 8 评论 0原文

我有一个使用 Axis2/Java 构建的 Web 服务。 Web 服务将接收对象列表并处理它们。我将使用以下操作作为示例。

public class AddToDatabaseService{

  public void addToDatabase(String name1, String name2, String name3, ....)
  {
    //add names to database
  }
}

我希望 Web 服务的调用者使用如下 URI: http://localhost:8080/axis2 /services/addToDatabase?name1=Joe&name2=Bob&name3=Kelly&name4=...

我知道这不是可编译的代码,但这个想法仍然存在。这对于基于 SOAP 的 Web 服务是否可行?我知道这可以通过 RESTful 服务来实现,因为您只需获取 HttpServletRequest 请求对象并执行 Enumeration enumeration = request.getParameterNames() 并迭代它们即可。

我正在寻找 Axis2 的 Web 服务 POJO 中的等效项。 一个链接或示例程序就太好了!

谢谢。

I have a web service that I built with Axis2/Java. The web service will take in a list of objects and will process them. I'll use the following operation as an example.

public class AddToDatabaseService{

  public void addToDatabase(String name1, String name2, String name3, ....)
  {
    //add names to database
  }
}

I want the caller of my web service to use a URI like:
http://localhost:8080/axis2/services/addToDatabase?name1=Joe&name2=Bob&name3=Kelly&name4=...

I'm aware this is not compilable code and the idea is still there. Is this even possible with SOAP-based web services? I know this is possible to do with RESTful services because you can just take the HttpServletRequest request object and do Enumeration enumeration = request.getParameterNames() and iterate through them.

I'm looking for the equivalent of that in web services POJO's with Axis2.
A link or an sample program would be great!

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

霞映澄塘 2024-09-01 10:07:41

与此问题类似,

解决方案是使用varargs 参数

Similar to the this question

Solution was to use a varargs parameter

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文