0

In our project we have multiple web service references. The methods of the web services return an object with the name RESPONSE. The format of the RESPONSE depends on the web service reference.

Sometimes the application confuses the return value.

A message appears like

WebService1.RESPONSE cannot be converted to WebService2.Response`

while we called a method from WebService2.

What can we do to avoid this?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
NEØ
  • 1
  • 1
  • Did you try casting it? – aaronR Sep 12 '17 at 03:39
  • Make sure you are using the correct one. So when calling the service do this: `WebService1.RESPONSE resp = svc1Client.Whatever()`. You have not posted any code so... – CodingYoshi Sep 12 '17 at 03:40
  • So the actual RESPONSE from each service call may be different? Why not rename the RESPONSE to something a little more unique like WS1RESPONSE and WS2RESPONSE. Even if you got that to work, your going to be kicking yourself in 5 years... – Mike Sep 12 '17 at 03:41
  • 1. The confusing is not on top level but deep inside MS code. 2. Changing the return code is difficult because also other systems uses the services. The difference is that they all uses one single reference. – NEØ Sep 12 '17 at 03:47
  • Yes indeed, if it cannot be fixed in a standard manner we will add extra methode's with the same implementation and with different return types. – NEØ Sep 12 '17 at 03:56
  • Sounds like you need serious code review. I would go bananas if something is called response or Webservice1. Who named these things? Might as well just use x, y, z.l This is a clear indication that you have no coding standards as you clearly show no naming convention. This is the pit you fall into by not having them defined. – Namphibian Sep 12 '17 at 22:31
  • When the cursor is moved above the variables and the methods in the source code then the types are ok. Again, it looks like if the confusion starts inside referenced MS assemby code. No casting is used in our source code and the compilation result is ok. – NEØ Sep 20 '17 at 10:21

0 Answers0