In this lesson, you create a Visual C# application to communicate with the web server.
This lesson assumes that you have set up a web server as instructed in lesson 1.
A recent version of Visual Studio is required to complete this lesson.
This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Using Visual C# to access a SOAP/DISH web service.
This lesson contains several references to localhost. Use the host name or IP address of the web server from lesson 1 instead of localhost if you are not running the web client on the same computer as the web server.
This example uses functions from the .NET Framework 2.0.
The XML response from the web server includes a formatted result set. All column data is converted to a string representation of the data. The following result set illustrates how result sets are formatted when they are sent to the client:
<row> <EmployeeID>102</EmployeeID> <ManagerID>501</ManagerID> <Surname>Whitney</Surname> <GivenName>Fran</GivenName> <DepartmentID>100</DepartmentID> <Street>9 East Washington Street</Street> <City>Cornwall</City> <State>NY</State> <Country>USA</Country> <PostalCode>02192</PostalCode> <Phone>6175553985</Phone> <Status>A</Status> <SocialSecurityNumber>017349033</SocialSecurityNumber> <Salary>45700.000</Salary> <StartDate>1984-08-28-05:00</StartDate> <TerminationDate xsi:nil="true" /> <BirthDate>1958-06-05-05:00</BirthDate> <BenefitHealthInsurance>1</BenefitHealthInsurance> <BenefitLifeInsurance>1</BenefitLifeInsurance> <BenefitDayCare>0</BenefitDayCare> <Sex>F</Sex> </row>
Columns containing date or time information include the offset from UTC of the web server. In the above result set, the offset is -05:00 which is 5 hours to the west of UTC (North American Eastern Standard Time).
Columns containing only the date are formatted as yyyy-mm-dd-HH:MM or yyyy-mm-dd+HH:MM. A zone offset (-HH:MM or +HH:MM) is suffixed to the string.
Columns containing only the time are formatted as hh:mm:ss.nnn-HH:MM or hh:mm:ss.nnn+HH:MM. A zone offset (-HH:MM or +HH:MM) is suffixed to the string.
Columns containing both date and time are formatted as yyyy-mm-ddThh:mm:ss.nnn-HH:MM or yyyy-mm-ddThh:mm:ss.nnn+HH:MM. The date is separated from the time using the letter 'T'. A zone offset (-HH:MM or +HH:MM) is suffixed to the string.
The DATATYPE ON clause was specified in the previous lesson to generate data type information in the XML result set response. A fragment of the response from the web server is shown below. The type information matches the data type of the database columns.
<xsd:element name='EmployeeID' minOccurs='0' type='xsd:int' /> <xsd:element name='ManagerID' minOccurs='0' type='xsd:int' /> <xsd:element name='Surname' minOccurs='0' type='xsd:string' /> <xsd:element name='GivenName' minOccurs='0' type='xsd:string' /> <xsd:element name='DepartmentID' minOccurs='0' type='xsd:int' /> <xsd:element name='Street' minOccurs='0' type='xsd:string' /> <xsd:element name='City' minOccurs='0' type='xsd:string' /> <xsd:element name='State' minOccurs='0' type='xsd:string' /> <xsd:element name='Country' minOccurs='0' type='xsd:string' /> <xsd:element name='PostalCode' minOccurs='0' type='xsd:string' /> <xsd:element name='Phone' minOccurs='0' type='xsd:string' /> <xsd:element name='Status' minOccurs='0' type='xsd:string' /> <xsd:element name='SocialSecurityNumber' minOccurs='0' type='xsd:string' /> <xsd:element name='Salary' minOccurs='0' type='xsd:decimal' /> <xsd:element name='StartDate' minOccurs='0' type='xsd:date' /> <xsd:element name='TerminationDate' minOccurs='0' type='xsd:date' /> <xsd:element name='BirthDate' minOccurs='0' type='xsd:date' /> <xsd:element name='BenefitHealthInsurance' minOccurs='0' type='xsd:boolean' /> <xsd:element name='BenefitLifeInsurance' minOccurs='0' type='xsd:boolean' /> <xsd:element name='BenefitDayCare' minOccurs='0' type='xsd:boolean' /> <xsd:element name='Sex' minOccurs='0' type='xsd:string' />