You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jim Talbut <jt...@spudsoft.co.uk> on 2010/02/18 21:31:05 UTC

How to get the soap:address location in the "?wsdl" to match the wsdl:import location?

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


Re: How to get the soap:address location in the "?wsdl" to match the wsdl:import location?

Posted by Jim Talbut <jt...@spudsoft.co.uk>.
Please find attached a simple example.
This:
<jaxws:endpoint id="wsServer"
                     implementor="#server"
                     address="http://0.0.0.0:8080/Maths"
                     depends-on="jetty-factory"
 >
<jaxws:properties>
<entry key="autoRewriteSoapAddress" value="true"/>
</jaxws:properties>
</jaxws:endpoint>

Queried as this:
   http://localhost:8080/Maths?wsdl
Produces this:
<soap:address location="*http://0.0.0.0:8080/Maths*" />

Note that this example uses jetty from within a war, I hope this doesn't 
affect its validity.


Another feature that would be useful is the handling of other service 
ports in the same file.
i.e. if I have a WSDL file generated by .NET it will always have 
bindings for both SOAP and SOAP12.
When autoRewriteSoapAddress is working correctly it only rewrite one of 
those two, leaving the other with an invalid entry.

Thanks.

Jim

On 25/02/2010 02:26, Daniel Kulp wrote:
> Any chance you could create a small test case that shows the
> autoRewriteSoapAddress not working fully from Spring?    That would make it
> easier for use to dig in and debug.    My gut feeling is it's being set on the
> Endpoint, not the EndpointInfo, when set from Spring, but a good testcase
> would be a big help
>
> Thanks!
> Dan
>
> On Sat February 20 2010 1:39:09 am Jim Talbut wrote:
>    
>> 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=EmailSchedule
>>> rTargetPortType.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
>>>        
>    


Re: How to get the soap:address location in the "?wsdl" to match the wsdl:import location?

Posted by Daniel Kulp <dk...@apache.org>.
Any chance you could create a small test case that shows the 
autoRewriteSoapAddress not working fully from Spring?    That would make it 
easier for use to dig in and debug.    My gut feeling is it's being set on the 
Endpoint, not the EndpointInfo, when set from Spring, but a good testcase 
would be a big help

Thanks!
Dan

On Sat February 20 2010 1:39:09 am Jim Talbut wrote:
> 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=EmailSchedule
> > rTargetPortType.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

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: How to get the soap:address location in the "?wsdl" to match the wsdl:import location?

Posted by Jim Talbut <jt...@spudsoft.co.uk>.
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
>