Hi all,
I've written a Windows Service, which hosts a WCF Web Service. I'm now trying to work out how I consume this via a client.
I've previously used svcutil.exe to generate a proxy class from WCF Web Service hosted in IIS by pointing the svcutil.exe to the address where it is hosted - how can I alter this to point to the location of the windows service?
Cheers,
Greg
Loading
GregPosted Oct 22, 2007, 10:20 AM
http://ipaddress:8000/MyService
I'm sure I'd tried this earlier, but hey-ho, its working now!
GregPosted Oct 22, 2007, 8:37 AM
Firstly - thanks for the reply. Unfortunately it hasn't quite answered my question though...
I've also email this to you aswell...
Ok, here goes:
Up to now, I've been developing .NET 3.0 WCF Web Services with no problems. I've always hosted them in IIS, and therefore I've had a known web address for getting the .svc file from, in order to generate the proxy.cs file.
i.e. svcutil.exe http://mymachine.mycompany.co.uk/webapps/Service.svc?wsdl /out:"F:\Source Code\WCF Web Service Testing\WCFClientApp\WFCClient\Proxy.cs" /config:"F:\Source Code\WCF Web Service Testing\WCFClientApp\WFCClient\app.config"
However, I'm now trying to host my WCF Web Service in a Windows Service. I've managed to implement that, install the service and it runs without any problems. I'm now wondering how I change the svcUtil.exe path to point to that windows service... Is it just a case of 'http://ipaddress/MyService?wsdl'
I've seen examples using: 'http://ipaddress:8000/MyService' but that hasn't worked for me!?!
Any ideas?
Thanks for taking the time...
Cheers,
Greg
Khilitchandra PrajapatiPosted Oct 22, 2007, 8:29 AM
hi greg,
consuming service in the client is really straight forward and easy process if you know the right path to be followed. i am going to explain the standard procedure for that, that will help you for sure.
Steps to be followed: [Note: I am assuming that you have already installed Framework 3.0]
Now, according to your question, you can generate the proxy file as well as the config file. now you have to simply add that proxy file into your client applicaiton, by choosing the option for the "Add New Item -> Existing Item", and suppose if your client applicaiton is web application then you have to modify / add the web.config file into your client applicaiton. suppose you have already got added the web.config then just copy paste the to area from the autogenerated config file and paste into the existing client applicaitons's web.config file under as new tab. thats it. but in case you have the windows application then you have to add the applicationconfiguration file manually and do the same thing for that, what we did for the web.config file. then simply compile the project.
now you can access the namespace in your client code, if you have any. but if you dont have namespace then, you can directly create the "client" in your code of the service object.
for example, your service name is "MathService" then in client applicaiton code you will get this in intellisence as "MathServiceClient" then make the object of this client and initialized it. once you through this. you can access all the funcationalities of service.
way to go. if you have any problem then contact me on [email protected]
regards,
smartkhilit