You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Bruno Melloni <Br...@chickasaw.net> on 2009/08/18 16:05:05 UTC

Accessing address in application.

If an application declares a client in the context like:

<jaxws:client address="http://myHost:8080/MyWebSvcApp/MySvc"  serviceClass="myPackage.MyInterface" />

In the application Java code I get an object of type MyInterface with the methods I want to call.  Easy. Love it.

I have an application that for failover uses

    <property name="emailClients">
      <list>
  <jaxws:client address="http://myHost1:8080/MyWebSvcApp/MySvc"  serviceClass="myPackage.MyInterface" />
  <jaxws:client address="http://myHost2:8080/MyWebSvcApp/MySvc"  serviceClass="myPackage.MyInterface" />
  <jaxws:client address="http://myHost3:8080/MyWebSvcApp/MySvc"  serviceClass="myPackage.MyInterface" />
      </list>
    </property>

Works like a charm... it gives me a List<MyInterface> and if one call fails, my code fails over to the next object on the list to retry the call.

But for logging/audit purposes I need to track which address was called. The address is not exposed as part of the MyInterface client object.  How do I get it?  Is there a way to cast the object so that the service URL address is exposed?

Thank you.

Re: Accessing address in application.

Posted by Daniel Kulp <dk...@apache.org>.
Most likely, you would need to do:


Client client = ClientProxy.getClient(proxy);
client.getEndpoint().getEndpointInfo().getAddress();

That should retrieve the address that is being used.  


Dan



On Tue August 18 2009 10:05:05 am Bruno Melloni wrote:
> If an application declares a client in the context like:
>
> <jaxws:client address="http://myHost:8080/MyWebSvcApp/MySvc" 
> serviceClass="myPackage.MyInterface" />
>
> In the application Java code I get an object of type MyInterface with the
> methods I want to call.  Easy. Love it.
>
> I have an application that for failover uses
>
>     <property name="emailClients">
>       <list>
>   <jaxws:client address="http://myHost1:8080/MyWebSvcApp/MySvc" 
> serviceClass="myPackage.MyInterface" /> <jaxws:client
> address="http://myHost2:8080/MyWebSvcApp/MySvc" 
> serviceClass="myPackage.MyInterface" /> <jaxws:client
> address="http://myHost3:8080/MyWebSvcApp/MySvc" 
> serviceClass="myPackage.MyInterface" /> </list>
>     </property>
>
> Works like a charm... it gives me a List<MyInterface> and if one call
> fails, my code fails over to the next object on the list to retry the call.
>
> But for logging/audit purposes I need to track which address was called.
> The address is not exposed as part of the MyInterface client object.  How
> do I get it?  Is there a way to cast the object so that the service URL
> address is exposed?
>
> Thank you.

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

RE: Accessing address in application.

Posted by Bruno Melloni <Br...@chickasaw.net>.
Trying again.  Does anybody know how a client app can get the address URL of the <jaxws:client> being used?

Thanks,

b. 
-----Original Message-----
From: Bruno Melloni [mailto:Bruno.Melloni@chickasaw.net] 
Sent: Tuesday, August 18, 2009 9:05 AM
To: users@cxf.apache.org
Subject: Accessing <jaxws:client> address in application.

If an application declares a client in the context like:

<jaxws:client address="http://myHost:8080/MyWebSvcApp/MySvc"  serviceClass="myPackage.MyInterface" />

In the application Java code I get an object of type MyInterface with the methods I want to call.  Easy. Love it.

I have an application that for failover uses

    <property name="emailClients">
      <list>
  <jaxws:client address="http://myHost1:8080/MyWebSvcApp/MySvc"  serviceClass="myPackage.MyInterface" />
  <jaxws:client address="http://myHost2:8080/MyWebSvcApp/MySvc"  serviceClass="myPackage.MyInterface" />
  <jaxws:client address="http://myHost3:8080/MyWebSvcApp/MySvc"  serviceClass="myPackage.MyInterface" />
      </list>
    </property>

Works like a charm... it gives me a List<MyInterface> and if one call fails, my code fails over to the next object on the list to retry the call.

But for logging/audit purposes I need to track which address was called. The address is not exposed as part of the MyInterface client object.  How do I get it?  Is there a way to cast the object so that the service URL address is exposed?

Thank you.