I found an answer to this, but it's rather ugly.

The autoRewriteSoapAddress is the key, but I couldn't find any way to specify it in the Spring beans file.

Instead I have another bean that, on startup, runs through all the CXF endpoints and sets the autoRewriteSoapAddress on each of them:
    private void startup()
    {
        try
        {
String[] serverRegistryNames = beanFactory.getBeanNamesForType( ServerRegistry.class );

            for ( String serverRegistryName : serverRegistryNames )
            {
ServerRegistry serverRegistry = ( ServerRegistry ) beanFactory.getBean( serverRegistryName );
                List<Server> servers = serverRegistry.getServers();

                for ( Server server : servers )
                {
server.getEndpoint().getEndpointInfo().setProperty( "autoRewriteSoapAddress", true );
                }
            }
        }
        catch( Throwable ex )
        {
            log.error( "Fatal error" );
            log.error( "Throwable: {}", ex );
        }
    }

I think that the implementation of autoRewriteSoapAddress is incomplete without support for it in the spring XML.

I also had to update to at least CXF 2.2.5 to make this work.

Jim

On 18/02/2010 20:31, Jim Talbut wrote:
Hi,

I have a simple web service created using the following beans:
<jaxws:endpoint id="wsServer"
                    implementor="#server"
                    address="http://localhost:8082/ScheduledEmailUser";
                    depends-on="jetty-factory"
>
</jaxws:endpoint>

When I look at the ?wsdl response for it (from http://192.168.1.100:8082/ScheduledEmailUser?wsdl), it contains:

<wsdl:import location="http://192.168.1.100:8082/ScheduledEmailUser?wsdl=EmailSchedulerTargetPortType.wsdl";

<soap:address  location="http://0.0.0.0:8082/ScheduledEmailUser"/>

And if I go by machine name the wsdl:import location corrects to match.
Unfortunately that soap:address location is useless (literally).

I know I can use publishedEndpointURL to specify a value for the soap:address location, but I have external and internal clients with obviously different addresses for the same box. So I need to soap:address location to match that used by the wsdl:import (i.e. the host it was addressed as). I'm also running via a load balancer, so it's important that it says what the client specified, not just the IP address on which it was received.

Is this possible?
Looking at the source indicates that autoRewriteSoapAddress might be relevant, but I can't achieve anything with it (i.e. this doesn't work:
<jaxws:endpoint id="wsServer"
                    implementor="#server"
                    address="http://localhost:8082/ScheduledEmailUser";
                    depends-on="jetty-factory"
>
<jaxws:properties>
<entry key="autoRewriteSoapAddress" value="true"/>
</jaxws:properties>
</jaxws:endpoint>
)

I've managed with it being wrong until now because all my clients specified it separately - but now I've gained a Drupal client and its module doesn't have any way to separate the URL used from the soap:address in the WSDL.

Thanks.

Jim


Reply via email to