How can I change the autogenerated soap:address from a JAX-WS webservice WSDL deployed with Spring

13,315

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:

Share:
13,315
drublik
Author by

drublik

Updated on July 20, 2022

Comments

  • drublik
    drublik almost 2 years

    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.

  • Smalcat
    Smalcat about 9 years
    anyone knows how to do this in wildfly?
  • Steve
    Steve over 8 years
    our server also stood behind a loadbalancer and I had also issues changing the http to https. After all I solved it by adding the three values scheme="https" proxyName="host.com" proxyPort="443" to my server.xml of Tomcat.
  • Enoobong
    Enoobong almost 7 years
    Hey @Smalcat Did you find out how to solve on WildFly. Facing similar issue here. Please share if you did. Thanks!
  • user3132347
    user3132347 about 4 years
    any solutions for this issue. I'm also facing same issue