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

Source: Internet
Author: User
Tags soap web services
services|web|xml| check box even when invoked through SOAP, CAO activation retains its state and allows object references to be passed back and forth through soap. Both the name and the value remain in the class instance on the server, and the reference works correctly. Both scripts invoke the same compiled C # component, except that the. NET Remoting activation model is different.

In addition to invoking Cao Activation using CreateObject, you can also use a moniker with COM + that provides CAO activation instead of Wko (type name and assembly moniker). The following script:

' Create two objects directly
Set C1=getobject ("Soap:typename=refpass.child,assembly=refpass")
Set C2=getobject ("Soap:typename=refpass.child,assembly=refpass")
' Sets the name of the first object and calls several times
' To increment an object's internal counter
C1. SetName ("C1")
WScript.Echo C1. Countup ()
WScript.Echo C1. Countup ()
WScript.Echo C1. Countup ()
WScript.Echo C1. Countup ()
WScript.Echo C1. Countup ()
' Sets the name of the second object and calls several times
' To increment an object's internal counter
C2. SetName ("C2")
WScript.Echo C2. Countup ()
WScript.Echo C2. Countup ()
WScript.Echo C2. Countup ()
WScript.Echo C2. Countup ()
WScript.Echo C2. Countup ()
' Create parent object
Set P=getobject ("Soap:typename=refpass.parent,assembly=refpass")
' Passing child objects to the parent object and calling child objects from the parent object
WScript.Echo P.setref (C1)
WScript.Echo P.countup (C2)
WScript.Echo P.countup (C2)
WScript.Echo P.countup (C2)
WScript.Echo P.countup (C2)
' Now call the child objects stored inside the parent object
Dim C9
WScript.Echo P.countup (C9)
' Get the object from the parent object and call directly
Set C3 = P.getref ()
WScript.Echo C3. Countup ()

The following output is displayed:

C:\moniker>refpassca
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C1 1
C1 2
C1 3
C1 4
C1 5
C2 1
C2 2
C2 3
C2 4
C2 5
C1 5
C2 6
C2 7
C2 8
C2 9
C1 6
C1 7

This is the same as the output from the VBScript CreateObject (ProgID) example above. Because the general COM + activation path is intercepted by the SOAP proxy application, client-activated objects using COM + WEB services can be invoked using CoCreateInstance, CreateInstance, and other traditional COM + activation methods.

assembly and type name objects are also useful for remotely obtaining preconfigured client activation from managed code clients, as shown in the following example:

Imports System
Imports System.Runtime.InteropServices
Module REFPASSCL
Sub Main ()
Dim childmoniker = "Soap:assembly=refpass,typename=refpass.child"
Dim parentmoniker = "Soap:assembly=refpass,typename=refpass.parent"
Dim C1,c2,p as Object
C1 = Marshal.bindtomoniker (Childmoniker)
Console.WriteLine (C1. SetName ("C1"))
Console.WriteLine (C1. Countup ())
Console.WriteLine (C1. Countup ())
Console.WriteLine (C1. Countup ())
Console.WriteLine (C1. Countup ())
Console.WriteLine (C1. Countup ())
C2 = Marshal.bindtomoniker (Childmoniker)
Console.WriteLine (C2. SetName ("C2"))
Console.WriteLine (C2. Countup ())
Console.WriteLine (C2. Countup ())
Console.WriteLine (C2. Countup ())
Console.WriteLine (C2. Countup ())
Console.WriteLine (C2. Countup ())
p = Marshal.bindtomoniker (Parentmoniker)
Console.WriteLine (P.setref (C1))
Console.WriteLine (P.countup (C2))
Console.WriteLine (P.countup (C2))
Console.WriteLine (P.countup (C2))
Console.WriteLine (P.countup (C2))
Dim C9
Console.WriteLine (P.countup (C9))
Dim C3 = P.getref ()
Console.WriteLine (C3. Countup ())
End Sub
End Module


Compiling and running this Visual Basic. NET application produces the same output as the previous two VBScript samples.


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.