如何在本地主机上启动 cxf 服务但在 wsdl 中返回外部地址?

发布于 2024-08-11 16:57:09 字数 829 浏览 1 评论 0原文

我在apache后面使用cxf和jetty通过soap公开web服务。目标是在所有情况下在 http://localhost:9000 上启动 jetty 并拥有 apache 代理,但有自动生成的 wsdl 显示适合其运行环境的soap:address(例如 http://api.testing.example .comhttp://api.uat.example.comhttps://api.example.com)。似乎生成的 wsdl2java *Service 类接受 wsdl 的 URL,并且该 URL 必须充当开始的“位置”以及soap:address 中返回的字符串。这必须是可配置的,但并不明显,所以建议值得赞赏。

更清楚一点 - 我通过 Spring 将“WsdlURL”传递给 Service 类的构造函数(到目前为止仅 http:// /localhost:9000 有效)。我需要解决此问题的方法是在 cxf.cml、cxf-.xml、spring 或其他配置文件中进行配置更改,而不是在代码中更改,因为此参数将根据其所在的环境而更改部署。

I'm using cxf and jetty behind apache to expose a webservice via soap. The goal is to start jetty on http://localhost:9000 in all cases and have apache proxy to it, but have the autogenerated wsdl show a soap:address appropriate to the environment it's running in (eg http://api.testing.example.com, http://api.uat.example.com, https://api.example.com). It seems that the generated wsdl2java *Service class accepts a URL for the wsdl and that must serve as both the "location" to start at as well as the string returned in soap:address. This must be configurable, but it ain't obvious, so advice is appreciated.

A little more clarity - I'm passing in the "WsdlURL" to the constructor of the Service class via Spring (so far only http://localhost:9000 works). I need the solution to this problem to be a configuration change either in cxf.cml, cxf-.xml, spring or some other config file, rather than in the code, since this parameter will change based on the environment to which it is being deployed.

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

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

发布评论

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

评论(2

云之铃。 2024-08-18 16:57:09

jaxws:endpoint 配置有一个“publishedEndpointURL”,如果指定了地址,则使用该“publishedEndpointURL”来代替地址。知道 servlet 正确使用它,但在码头上不能 100% 确定。他们共享很多代码,因此它可能有效。

The jaxws:endpoint configuration thing has a "publishedEndpointURL" which is used instead of the address if it's specified. In know the servlet uses that properly, not 100% sure on the jetty. They share a lot of code so it MAY work.

回梦 2024-08-18 16:57:09

尝试@WebService(wsdlLocation="http://yourdesiredlocation")。不确定它是否会起作用。

Try @WebService(wsdlLocation="http://yourdesiredlocation"). Not sure if it will work.

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