On 16/11/11 13:29, Simon Nash wrote:
Millies, Sebastian wrote:


can references in composite files somehow be made dynamic? In particular, can I define or override

the endpoints in a web service reference at run time?



I understand (correctly, I hope, I have not tested this) that I can override whatever endpoint is specified in the wsdl by

specifying the uri attribute on the web service binding.
I don't think this works, as the Uri has been read during startup before you get a chance to modify it.


Is there a way to define Tuscany web service references with dynamic endpoints? Or alternatively, could I perhaps use the endpointProperties

and modify the injected service proxy before making a remote call? Or is there some entirely different route that does not involve steps a) to f) above?



How would you deal with this type of situation?




It might be possible to use service references for this.  A service
reference can be serialized/deserialized to/from XML.  So you could
use runtime code to create the XML-equivalent form of the service
reference that you need, then deserialize the XML to create the
service reference.

We tried something like this, but failed to get it to work fully.

We have a client that needs to talk to multiple identical services, and got it working successfully using multiplicity references. However, this is a static solution where the client knows all the services it will use at startup.

We then tried a solution where, as each service starts up, it creates a ServiceReference to itself, marshals that into Base64, and calls an endpoint on the client, passing in its ServiceReference, which is stored in an internal directory (basically a HashMap). The client is then able to retrieve the endpoints from its internal directory and use them.

However, a service registering with a client is a little bizarre. We really wanted the service to register its ServiceReference with a directory service, and for the client to retrieve the ServiceReference(s) from the directory service. That is, replace the internal HashMap with an external service. This would be the classic Publish-Find-Bind model of Service Oriented Architecture.

However, we couldn't get it to work. The client can get the Base64 encoded ServiceReference, and perform the same actions as before, but we get a NullPointerException when attempting to use the reference.

It would be great to know if anyone else succeeds at this, as we feel so close to achieving dynamic binding in Tuscany,...and yet so far.

Jon.

Reply via email to