10
votes

I have a webservice implementation generated using wsimport from a WSDL. This service is deployed in a Tomcat server in a Spring webapp. The spring configuration file (only the webservice part) is like this

<wss:binding url="/fooService">
    <wss:service>
        <ws:service bean="#fooService">
    </wss:service>
</wss:binding>

When I deploy this webapp in tomcat, I can get the WSDL if I go to

http://localhost:8080/foo/fooService?wsdl 

and the wsdl soap:address property is like this:

<service name="FooService">
    <port name="FooService" binding="tns:FooServiceBinding">
        <soap:address location="http://localhost:8080/foo/fooService"/>
    </port>
</service>

And for now, it's all ok.

The problem is that in production, we have an Apache web server and this server redirects the requests to Tomcat. It works too, but when we get the WSDL, the soap:address is still localhost:8080 and we need this to be the public url to the webservice.

Any ideas?

Thank you very much.

1
please can let me know what your xml spring schema headers were in order to satisfy spring binding for port and soap in your code snippet above to register custom endpoint address and port. I have tried jax-ws.dev.java.net/spring/core, servlet, and local-transport but see none of them reference these. As a result, i get saxparserexceptions. Cannot find an easy answer. Thanks in advance for any assistance. - arcseldon
doh! ok, you are referencing wsdl file here. apologies, am seeking how to override the endpoint address in config. - arcseldon

1 Answers

9
votes

Well, I've found one solution:

It seems that JAX-WS generates this property automatically. I've found that other webservice frameworks implementations, allow the user to change this by hardcoding the url in a property, but it seems that JAX-WS doesn't. Somebody knows if there is some way?

Anyway, I've found a workaround: Using proxyName and proxyPort properties in tomcat Connector configuration, you can tell Tomcat that is behind a proxy (in our case, Apache server) and that the "real" port for the clients is 80.

Doing this change, the autogenerated soap:address contains the correct value.

References: