没有输入参数的 Web 服务

发布于 2024-12-04 00:07:01 字数 520 浏览 6 评论 0原文

我需要创建一个不应该接受任何参数的 Web 服务方法。我使用 jax-ws 和 apache xref 从 wsdl 生成 Java 源代码。我无法省略输入消息(发生错误)。这样做的最佳方法是什么?到目前为止,我已经找到了以下解决方案

<message name="getTermRequest" />

<message name="getTermResponse">
  <part name="value" type="xs:string"/>
</message>

<portType name="glossaryTerms">
  <operation name="getTerm">
    <input message="getTermRequest"/>
    <output message="getTermResponse"/>
  </operation>
</portType>

,但也许您可以提出更好的建议?

I need to create a web service method which is not supposed to take any params. I'm using jax-ws and apache xref for generation Java sources from wsdl. I cannot omit input message (an error occurs). What is the best way for doing this? So far I have found the following solution

<message name="getTermRequest" />

<message name="getTermResponse">
  <part name="value" type="xs:string"/>
</message>

<portType name="glossaryTerms">
  <operation name="getTerm">
    <input message="getTermRequest"/>
    <output message="getTermResponse"/>
  </operation>
</portType>

but may be you can suggest something better?

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

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

发布评论

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

评论(1

红ご颜醉 2024-12-11 00:07:01

如果您想修改现有的 wsdl 文件(这似乎是 rpc/lit wsdl),那么您所做的方法就可以了。您无法删除输入的消息,因为这会使 Web 服务操作只剩下一条。

但是如果您可以从 POJO 代码开始(即代码优先),那么您可以编写一个无参数的服务方法并让框架生成 wsdl。

If you want to modify an existing wsdl file (this seems to be a rpc/lit wsdl) then the method you have done is fine. You can not delete the input message since that make the web service operation out only one.

But if you can start with the POJO code (i.e code first) then you can write a service method parameter less way and let framework to generate the wsdl.

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