Web Service

I have a c# web applications that contains two programmes. One of the programmes has a part which accepts a dictionary of contacts (name, email address) which either programme can use.

I now want to split the programmes into separate application on the same web server (different app pools), so I now need app 2 to send a dictionary to app 1. I think the best way to achieve this is via a web service on app 1. I have started the web service (asmx/cs) and think I can get that side of it working, but I can’t work out how to get app 2 to reference the web service from app 1.

How do I do this - I can’t find anything in the references that looks right! Do I need to compile a dll or anything like that? Any help or pointers in general greatly appreciated :slight_smile:

All you should need to do, is to add a service reference to your other project. Visual Studio should handle the rest. You could also look at creating a WCF service instead of older SOAP service

OK, so I’ve gone back and changed to a WCF and have added a reference in VS, but if it try this:

NominalCommunicationServiceClient client = new NominalCommunicationServiceClient();

it doesn’t work - the service is not recongnised (no intellience or colour coding)! Am I missing something? The page for the service has something about running this:

svcutil.exe http://localhost/npt/contacts/NominalCommunicationService.svc?wsdl

do i need to do that, or is that covered when i create the reference?

Could you not serialise the object to the file system? Get App 1 to write to the file system with your serialised object, and then get App 2 to read from that location.

That should be done automatically when you add a reference as it generates the classes you need. For the contracts, etc. This is a very strange issue. Can you resolve the WSDL in your browser and is it well formed?