Consuming the ASP.NET Web Service from an ASP Client Using SOAP Toolkit 2.0

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.

Listing 11.5 An ASP Client to Consume the ASP.NET Web Service ( Client.asp )
 <%@ 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.

Figure 11.10. The result of running the ASP web service client.
graphics/11fig10.gif

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


XML and ASP. NET
XML and ASP.NET
ISBN: B000H2MXOM
EAN: N/A
Year: 2005
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net