开发者

Getting an app.config key of console app from webservice referred by the console app

开发者 https://www.devze.com 2023-02-13 15:01 出处:网络
I have a console application (say CA) which calls many webservices (say WS1, WS2, WS3). All these webservices will have the same structure (meaning: exposes same webmethods but functionality chang开发

I have a console application (say CA) which calls many webservices (say WS1, WS2, WS3). All these webservices will have the same structure (meaning: exposes same webmethods but functionality chang开发者_如何学Goes based between WS1, WS2, WS3).

The Webservices are accessed from CA using a single proxy. (meaning: all Webservice's interfaces/webmethods structure are same).

The question is: Is it possible to access a particular key in app.config of CA inside WS3, but in the same time I should not change the structure of webmethod.


if i understood correct the CA is calling the webservices. so the webservice knows actually nothing about the CA which is just calling.

so you have no possibility to access any data from the WS which didnt get sent as parameters.

but anyway there should be no need to.


A service can not access anything about a client application. The client is the one that initiates the communication and the client is the one that determines what information is sent to the service. Conversely, when the services sends data to the client the service is in full control. The client can't get the service to send it information it doesn't want to.

So it's a cooperative communication if you will.

So there are a couple of way in which you can achieve the end result:

  1. Either change the method signature such that one of the parameters in the "key" you're looking for and the client can send this information over to the server just like any other parameter it sends to the server.
  2. If you have the option/ability, you can have the client stuff this extra info into the Http Header and have the server extract this info from the http headers it receives. Of course if you're using SOAP you might find this a bit "awkward"
0

精彩评论

暂无评论...
验证码 换一张
取 消