Skip to Content
Professional Visual Basic 2012 and .NET 4.5 Programming
book

Professional Visual Basic 2012 and .NET 4.5 Programming

by Bill Sheldon, Billy Hollis, Rob Windsor, David McCarter, Gastón Hillar, Todd Herman
January 2013
Intermediate to advanced
912 pages
26h 58m
English
Wrox
Content preview from Professional Visual Basic 2012 and .NET 4.5 Programming

Working with Data Contracts

In the preceding sample WCF service, the data contract depended upon simple types or primitive data types. A .NET type of Integer was exposed, which in turn was mapped to an XSD type of int. You might not have noticed the input and output types actually defined in the WSDL document that was provided via the WCF-generated one, but they are there. These types are exposed through an imported .xsd document (a dynamic document). This bit of the WSDL document is presented here:

<wsdl:types>
   <xsd:schema targetNamespace="http://tempuri.org/Imports">
   <xsd:import schemaLocation="http://localhost:8000/calculator?xsd=xsd0"
    namespace="http://tempuri.org/" />
   <xsd:import schemaLocation="http://localhost:8000/calculator?xsd=xsd1"
    namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
  </xsd:schema>
</wsdl:types>

Typing in the XSD location of http://localhost:8000/calculator?xsd=xsd0 gives you the input and output parameters of the service. For instance, looking at the definition of the Add method, you will see the following bit of XML:

<xs:element name="Add">
   <xs:complexType>
      <xs:sequence>
         <xs:element minOccurs="0" name="a" type="xs:int" />
         <xs:element minOccurs="0" name="b" type="xs:int" />
      </xs:sequence>
   </xs:complexType>
</xs:element>
<xs:element name="AddResponse">
   <xs:complexType>
      <xs:sequence>
         <xs:element minOccurs="0" name="AddResult" type="xs:int" />
      </xs:sequence>
   </xs:complexType>
</xs:element>

This XML code indicates that there are two required ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Visual Basic 2012 Programmer's Reference

Visual Basic 2012 Programmer's Reference

Rod Stephens

Publisher Resources

ISBN: 9781118332139Purchase book