Dynamic web service reference in Endpoint Assembly .dll

  • 27 August 2014
  • 4 replies
  • 0 views

Badge +4

Hello, any ideas on the following topic:

 

I added an 'Endpoint Assembly" ServiceInstance, the .dll used for this endpoint has a Webservice reference.

However on each of our environments this webservice has a different URL.

 

When moving the ServiceInstance to a different environment: can I change the WebService URL without having to edit the .dll? I tried changing the .dll.config and edited the values noted for the webservices. This seemed to have no effect.

 

Thanks!


4 replies

Badge +8

To use a web service, you need to use an Endpoints Web Service service instance, not an Endpoints Assembly service instance.

 

The Endpoints Web Service service instance allows you to specify the URL of the service it should be using.

Badge +4

I am aware of this and have used webservice endpoints before (which worked fine).

 

However in this case I need to perform 'complex' operations on the data returned by two webservices - not just a simple 'listing' of data. And one of the webservices requires a specific HTTP header apparently not supported by K2 at this point so the K2 Service Center told me I could use an assembly to reference this (which works).

 

So presuming I need to use an assembly: is it possible to change the webservice URL?

Badge +8

Oh, I see... so you are calling the web service from within the assembly and you want to change that URL?

 

In that case, just put the URLs in a config file somewhere.  These are standard .NET assemblies, so you can reference and use the System.Configuration.ConfigurationManager namespace just as you would in any other assembly.  We happen to stick our values in machine.config, but you could probably stick them in the K2 config or someplace similar if desired.

Badge +4

Ok, I'll try it out, thanks!

Reply