Tuesday, September 15, 2009

Lab #3: Using Tools to Generate Clients and Services

Members:
Rafael Zuniga, Stephen Cave

Summary:
Loading a premade solution, we are given a client and host project. Adding a WCF template we start our hello indigo service, adding code and references for both, and compiling with no errors.
Next we create a configuration file (after deleting the pre-supplied one) using WCF Service Configuration Editor, and enable service metadata with a metadata exchange endpoint.
Next we get to generate a client proxy with the Add Service Reference, which uses SvcUtil. A bunch of files are generated properly setting up the client, and after compiling the client is run and returns the intended output from the service.
Next we create another project with the WCF Service Library template - HelloIndigo. Small modifications to the service contract and implementation, and a compile results in no errors. Then we delete the app.config file and compile again - no errors. Next we hide the previous service files in Host, and reference to the new class library. With some more modifications to the program.cs and app.config files, we have the service referenced and can compile and run with no errors.
Next we move on to generating a proxy directly with SvcUtil, starting by allowing the host to continue running. We use visual studio's command line to access svcutil with the appropriate arguments and generate the proxy!
With another exclusion and some modifies to the client program.cs, we compile and run the client after no errors, and see the appropriate output.

Notes on Usefulness:
Learning how to construct proxies automatically is a very useful tool, where remembering all the specifications takes the place of constructing the code. Using SvcUtil directly also makes you look like a cool hacker in cmd mode, though typing anything in console is a pain and a half.

Differences/problems/mistakes -> troubleshooting:
-Supplied code in book for program.cs in Main() has some syntax errors with all the curly braces
-System.ServiceModel.AddressAccessDeniedException is thrown, got to remember to start visual studio with administrator privilages from now on (using windows 7 or vista I believe causes this)
-once again copy/paste from the book to load the command line string proved annoying to correct
-There's a grammar error in the book for the portion on renaming the service library .cs files
-localhostreference.svcmap is named reference.svcmap under local host in my version
-when modifying the final program.cs, the book states a "using()" when there shouldn't be one

No comments:

Post a Comment