only for RuBoard |
You can use SOAP Toolkit 2.0's high-level API to consume the Calculator web service from an ASP page. The example in this section demonstrates the interoperability of web services by showing you how a web service built in a managed environment can be consumed from an unmanaged environment. The same idea exists for a Visual Basic desktop client, a Java client, or potentially any client that can send valid SOAP requests to the service and read the SOAP requests sent by the service. Listing 11.5 shows the code for the Client.asp page. It's essential that you download and install the SOAP Toolkit before running this example.
<%@ Language=VBScript %> <% Option Explicit Dim soapClient , c , a, b a = 4 b = 3 Set soapClient = Server.CreateObject("MSSOAP.SoapClient") call soapClient.mssoapinit( "http://localhost/WebServices/Calculator/Calculator.asmx?WSDL" ) Response.Write "<B> Add( a , b ) returned ::<B>" & _ soapClient.Add( a , b ) & "<BR>" Response.Write "<B> Subtract( a , b ) returned :: <B>" & _ soapClient.Subtract( a , b ) %>
Figure 11.10 shows the result in the browser.
Note
You can download the SOAP Toolkit 2.0 SP2 from Microsoft's download center at http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/MSDN-FILES/027/001/580/msdncompositedoc.xml.
only for RuBoard |