COM + Web service: Routing to XML Web services by check box 3

Source: Internet
Author: User
Tags soap web services microsoft c wsdl
services|web|xml| check box The application is now published as an XML Web service and can be activated using SOAP. Using Internet Explorer to browse to Http://localhost/VB6Soap/default.aspx, you find a hyperlink on the ASPX page that links to the WSDL generated by your component. The following VBScript activates your component:

Set c = GetObject
("SOAP:WSDL=HTTP://LOCALHOST/VB6SOAP/VB6SOAP.CALC.SOAP?WSDL")
For i = 1 to 10
WScript.Echo I & "" & C.add (i,i) & "" & Time
Next

If you replace the localhost in the above script with your server name, it can also work on the remote client computer. The referenced page (in this example, VB6Soap.Calc.soap) is a component ProgID that ends with a. Soap suffix.

To access the same endpoint via the SOAP Toolkit (provided with Windows XP Professional and not using. NET Remoting), run the following VBScript:

Set C = CreateObject ("Mssoap.") SoapClient ")
C.mssoapinit ("Http://localhost/VB6Soap/VB6Soap.Calc.soap?WSDL")
For i = 1 to 10
WScript.Echo I & "" & C.add (i,i) & "" & Time
Next

To simplify the process of publishing SOAP on a server, you can use Microsoft c#™ or Visual Basic. NET and inherit from ServicedComponent. The following are examples of managed code for a simple managed component:

Using System;
Using System.Reflection;
Using System.Runtime.InteropServices;
Using System.EnterpriseServices;

[Assembly:applicationname ("Cssoap")]
[Assembly:applicationactivation (Activationoption.server,
soapvroot= "Cssoap")]
[Assembly:assemblykeyfile ("Cssoap.snk")]
Namespace Cssoap
{
public interface Icalc
{
Double Add (double Value1, double Value2);
}

[ClassInterface (Classinterfacetype.autodual)]
[TransactionAttribute (Transactionoption.none)]
public class Calc:servicedcomponent, Icalc
{
Public double Add (double Value1, double Value2);
{
Return (Value1 + Value2);
}
}
}

Notable in the above example is the ApplicationActivation property:

[Assembly:applicationactivation (Activationoption.server,
soapvroot= "Cssoap")]

Establish a C # component, install it in the global assembly cache, and then run Regsvcs.exe to register it as a COM + application. The component is then published as an IIS virtual root and a SOAP endpoint. To successfully use ServicedComponent remotely, you will also need to use the Gacutil.exe or. NET Framework user interface to put this compiled assembly into the global Assembly cache (GAC). To access this SOAP endpoint through WSDL, use the following VBScript:

Set c = GetObject
("SOAP:WSDL=HTTP://LOCALHOST/CSSOAP/CSSOAP.CALC.SOAP?WSDL")
For i = 1 to 10
WScript.Echo I & "" & C.add (i,i) & "" & Time
Next

As a simple example of SOAP interoperability, SOAP Toolkit is provided with Windows XP Professional, and even if the. NET framework is not installed on client computers running Windows XP, the following VBScript can also be used to access COM + SOAP endpoint:

Set C = CreateObject ("Mssoap.") SoapClient ")
C.mssoapinit ("Http://localhost/CSSoap/CSSoap.Calc.soap?WSDL?")
For i = 1 to 10
WScript.Echo I & "" & C.add (i,i) & "" & Time
Next



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.