views:

31

answers:

1

I have two separate web services, the first configured to extract data from a live database, the second from a test database.

When consuming these web services from an application the object returned is a MyMessageData class which is defined in the web service.

In the application I would like to instantiate a empty the MyMessageData (from the live web service) and then use a configuration setting to decide which web service to retrieve the actually data from.

This does not work for test because the application does not see the instantiated MyMessageData class from live as the same type as the MyMessageData that is returned from the test webservice.

Can you please suggest a way I can get this behavior?

Possible options I have thought of are:

  • Extracting the MyMessageData so that both web services use the same type but this seems like a long way round for something as small as a MessageDataClass
  • Having separate Binding functions for the two MyMessageData classes to the MyMessage class, which is what I'm trying to avoid

Thanks

A: 

Are you using separate service references or web references for test and live? Don't. Use one service reference. That will give you one type. Then, change the configuration to point the reference to the URL of the live or test site.

John Saunders