not logged in  
login | register  

Docs:

Documentation
Web Services
FAQs
Downloads
Contact
References

Up

2.3 Clients to multiple web services

It is an interesting issue to write a web service client that access multiple services in parallel. If these remote services use different WSDL file (they export different functions) but use the same class declarations to allow data exchange you will need some tricks to write your client code. Web service proxy generators usually generate a java or c# file with all the function and class declarations that are described in the WSDL file. All these declarations usually will be under a namespace generated from the hostname of the service url.

For better understanding, consider the following situation. You want to load spectra from a web service called Search and pass them to an other service called Util which will make some scientific operation on the spectra. You generate the proxies for both services and will have two namaespaces similar to this:

File 1:

namespace MyClient.net.voservices
{
// proxy clas
class Search
{
Sed GetSpectrum(string id) { ... }
}

// type declarations
class Sed
{
Target Target;
Segment[] Segments;
...
}

}

File 2:

namespace MyClient.edu.myservice
{
// proxy clas
class Util
{
void DereddenSpectrum(Sed spectrum) { ... }
}


// type declarations
class Sed
{
Target Target;
Segment[] Segments;
...
}

}

Now, as you can see, there are two different declarations for the same class (Sed), but they're not in the same namespace. The problem with this is that a class returned by the GetSpectrum function has not the same type as the parameter of the DereddenSpectrum function. This situation causes a compile-time error and the automatically generated code needs modifications. The easiest way to overcome this issue is the following:

  1. Comment out all common type declarations in all of the proxy classes except one
  2. Put all proxy classes into the same namespace by renaming them