Constructing a Proxy Class

In this section, I discuss how to create a client application that consumes the latter two Web Services created earlier in this chapter. The steps are

  1. Create the application and save it to a directory.
  2. Add a Web Reference; this will create the proxy class.
  3. Use the proxy class.

Assuming that step 1 is completed, adding the Web Reference is simple. Simply select the project within the Project Manager in the IDE and invoke the local menu by right-clicking. One of the options is Add Web Reference (see Figure 28.9).

This launches the Add Web Reference dialog box. Through this dialog box, you can enter the URL of known Web Service URLs or you can also select from one of the UDDI directories presented in the dialog box. For now, we'll use the URL from one of the Web Services we created. The URL we need is


Specifying the ?WSDL parameter will return the WSDL document that we need to generate a proxy class. When you click the blue arrow button on the Add Web Reference dialog box, you will see the WSDL in the dialog box as shown in Figure 28.10.

FIGURE 28.9 Add Web Reference menu from the Project Manager.

0 Add Web Reference

| @ @ ¡http ://localhost/WìiFlrstWeb5erv1ce/Web5efvice 1 .asira?W5DL

<?xml ver5ion=*1.0' encading=*utf-8" ?> - «definitions xmlns: http='http://schsmas .xml soap .org/wsdl/http/' xmlns:sDap="http://schGmas.xmlsoap.orq/wsdl/soap/" xmlns: s="http://www." x mlns : 5 D=" w w w .x a p w are .co m/M yF i rst Web S ervi ce" xmlns: 5oapenc=*http ¡//schémas," x m Ins : t m -"htt p :// rn icro soft .com/ws d l/m i me/te xt Mat chin g/" xmlns; mime=,http://schEmfis . xml son p .org/nisdl/mime/1 targ 9 tNa m es pa ce=1 w w w. xap wa re. com / M y FirstW e bs e ru ice ' xmlns="http://schGmas,xmlsoap,org/ivsdl/',> - <typQS>

- <s:schema elementFormOefault="gualifiedI

t arg e t Na m es pa ce=1 vt wiv. xd p wd re. com / M y First W e bSe ru ice1 >

- es: element name="HelloWoridr>

<s:compIexType /> </s:element>

  • lt;s: element name-'Hell oWo rid Res ponse"> - <s:complBxType>
  • lt;s:seguence>

<s ; eleme nt m in 0 cc urs="D" ma «Oc cu rs=" l ' narne="HelloWorldRGSult" type="s:string" /> <Js\ seque nce> </s : co m plexTyp e> </s:element>

To add a web refer ecce to the project, navigate to a web scrvico description cfccument in the brotwer and tick the Add Reference button.

Web reference folder name jbcalhost

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment