views:

140

answers:

2

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.

A: 

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

Bozho
It appears that the wsdlLocation parameter is expected to be a path to the local file, rather than a URL.
evil_breeds
it is parsed as an URL object, so can be both, generally speaking.
Bozho
The problem I see here is that the address is encoded in the source and can't be changed via configuration
Kevin
+2  A: 

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.

Daniel Kulp
I tested this on CXF 2.2.3/Jetty 6.1.11 and it works. However, you need to update the CXF JAXWS configuration page in the users guide to include this parameter :)
Kevin
At the moment I'm using annotations to do most of the configuring, which means I don't have easy access to the proper configs, and it's starting to drive me crazy. I will attempt to undo the annotations and go with full spring config, and try your solution (which bodes well given this link: http://issues.apache.org/jira/browse/CXF-1279).
evil_breeds