开发者

How to start cxf service on localhost but return external address in wsdl?

I'm using cxf and jetty behind apache 开发者_StackOverflow社区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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜