You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Pedro David Lopez <pe...@gmail.com> on 2008/04/02 16:27:36 UTC

Change the ws binding uri

Hi, I have this reference in the composite file and works fine

<reference name="AdminAccessService"
promote="AdminAccessServiceComponent/gwAdminAccess"
requires="authentication">
        <interface.java
interface="com.ptb.gwaccess.servicecomponents.AdminAccess"/>
        <binding.ws uri="http://192.168.1.254:8085/gwadmin"/>
 </reference>

But I need to change the binding ws uri in runtime. I am trying to do this:

        List<ComponentReference> references =
scaDomain.getComponentManager().getComponent("AdminAccessServiceComponent").getReferences();

/* Setting the service url for binding */
            for (ComponentReference ref : references) {
                if (ref.getName().equals("AdminAccessService")) {
                    for (Binding b : ref.getBindings()) {
                        b.setURI(url+name);

                    }
                }
            }

Re: Change the ws binding uri

Posted by Simon Nash <na...@apache.org>.
Pedro David Lopez wrote:
> Hi, I have this reference in the composite file and works fine
> 
> <reference name="AdminAccessService"
> promote="AdminAccessServiceComponent/gwAdminAccess"
> requires="authentication">
>         <interface.java
> interface="com.ptb.gwaccess.servicecomponents.AdminAccess"/>
>         <binding.ws uri="http://192.168.1.254:8085/gwadmin"/>
>  </reference>
> 
> But I need to change the binding ws uri in runtime. I am trying to do this:
> 
>         List<ComponentReference> references =
> scaDomain.getComponentManager().getComponent("AdminAccessServiceComponent").getReferences();
> 
> /* Setting the service url for binding */
>             for (ComponentReference ref : references) {
>                 if (ref.getName().equals("AdminAccessService")) {
>                     for (Binding b : ref.getBindings()) {
>                         b.setURI(url+name);
> 
>                     }
>                 }
>             }
> 
This won't do what you expect, because the URI that used to make
WebService invocations is part of an Invoker object that's created
at deployment time from the binding information.  Tuscany does not
currently permit you to get to Invoker objects and update them
at runtime.

The SCA philosophy is that applications deal only with references
and don't control how those references are resolved to specific
service endpoints.  Making the kind of update you are describing
from within an application would be contrary to this philosophy
because it requires the application to know about binding types
and endpoint addresses.

However, there could be use cases where some admin or management
code would want to make changes like this.  I'm not sure whether
they should be applied to deployed components that are currently
running, or just to new deployments.

Can you say more about your application and why it needs this
capability?  In particular, does the URI change need to affect
a running application without redeployment?

   Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org