Java Reference
In-Depth Information
<xs:sequence>
<xs:element name="i" type="xs:int" />
<xs:element name="j" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="addResponse">
<xs:sequence>
<xs:element name="return" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:schema>
The schema defines two elements: add , which takes two integers, and addResponse , which
has an element named return that holds the sum.
Let's get started making a full-blown GUI app that will frontend this calculator service. Open
the .NET framework console, and execute the following command, supplying the location of
your WSDL:
C:\Program Files\Microsoft Visual Studio 8\VC>wsdl
/out:C:/oreilly/soacookbook/code/chapters/interop/dotNetClient/Calcul
atorProxy.cs http://localhost:8080/CalculatorApp/
CalculatorWSService?wsdl
Here you just indicate that you want the wsdl utility to write the C# file to the specified loca-
tion on the filesystem, using the provided WSDL URL. The utility options always come first,
each indicated by a / character, followed by the option name, a colon, and the value. The
WSDL location always comes last, after the options list.
The code the WSDL tool generates looks like that shown in Example 12-8 , though I've cut
some unnecessary parts to keep it short and added a little formatting for readability.
Example12-8.CalculatorProxy.cs
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(
Name="CalculatorWSPortBinding", Namespace="http://calculator.me.org/
Search WWH ::




Custom Search