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

Source: Internet
Author: User
Tags interface soap microsoft sql server web services wsdl
services|web|xml| check box to establish and run this C # component, after you finish editing the connection value to connect to the Microsoft SQL Server™ database, you need to use Sn.exe to generate the Sctrans.snk enhanced name keyword file, and then in the using Statement to compile it using an assembly reference. If you are deploying on a server, use Gacutil.exe (if you are using the SDK) or put the assembly in the GAC through the. NET Framework user interface, and then run Regsvcs.exe to register the COM + managed component. Regsvcs.exe uses the following properties to publish the component as a SOAP endpoint and server (out-of-process) activation on the server:

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

This component uses a different transaction in each method invocation, has an automatic completion method, and is configured to buffer. When using managed and unmanaged COM + components, object pooling and transactions will run through SOAP as expected. For example, if you use the following VBScript to access the following ServicedComponent through SOAP:

Mon = "SOAP:WSDL=HTTP://JNOSS3/SCTRANS/SCTRANS.SCTRANSSQLNC.SOAP?WSDL"
WScript.Echo (Mon)
For i = 1 to 2
Set c = GetObject (Mon)
For j = 1 to 10
WScript.Echo I & "" & J & "" & C.countup ("Scwkonc")
Next
Next

The following output is displayed:

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

soap:wsdl=http://jnoss3/sctrans/sctrans.sctranssqlnc.soap?wsdl
1 1 486 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
1 2 487 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
1 3 488 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
1 4 489 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
1 5 490 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
1 6 8 NC Af26b53b-4a1f-48c8-8880-518c2b55a7ce
1 7 9 NC Af26b53b-4a1f-48c8-8880-518c2b55a7ce
1 8 NC Af26b53b-4a1f-48c8-8880-518c2b55a7ce
1 9 494 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
1 495 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
2 1 NC af26b53b-4a1f-48c8-8880-518c2b55a7ce
2 2 NC Af26b53b-4a1f-48c8-8880-518c2b55a7ce
2 3 NC Af26b53b-4a1f-48c8-8880-518c2b55a7ce
2 4 499 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
2 5 NC Af26b53b-4a1f-48c8-8880-518c2b55a7ce
2 6 501 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
2 7 502 NC 6e41f32f-74be-45f0-94c0-989e7e1c5672
2 8 NC Af26b53b-4a1f-48c8-8880-518c2b55a7ce
2 9 NC Af26b53b-4a1f-48c8-8880-518c2b55a7ce
2 NC Af26b53b-4a1f-48c8-8880-518c2b55a7ce

This is the expected buffer component: Drag the object from the buffer pool and reuse it. The behavior of using a client-activated buffering component is the same.

The object pools and transactions of unmanaged components also run as expected (although the Visual Basic 6.0 component does not support object pooling). You need to set buffering and transaction properties for most unmanaged applications through the COM + Administration tool.

Passing references
A key difference between Wko and CAO models is their ability to pass references to stateful objects. The following is the C # ServicedComponent example, which shows the basic steps of this operation:

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

[Assembly:applicationname ("Refpass")]
[Assembly:applicationactivation (Activationoption.server,
soapvroot= "Refpass")]
[Assembly:assemblykeyfile ("Refpass.snk")]
Namespace Refpass
{
public interface Iparent
{
String Setref (object inkid);
Object GetRef ();
String Countup (object obj);
}

public interface Ichild
{
String GetValue ();
String Countup ();
void SetName (string key);
}

[ClassInterface (Classinterfacetype.autodual)]
public class Parent:servicedcomponent, iparent
{
protected child _kid = null;

public string Setref (object Inkid)
{
_kid = (child) Inkid;
Return _kid. GetValue ();
}

public Object GetRef ()
{
Return (object) _kid;
}

public string Countup (object obj)
{
Child kid = (child) obj;
if (kid = null) return _kid. Countup ();
else return kid. Countup ();
}
}

[ClassInterface (Classinterfacetype.autodual)]
public class Child:servicedcomponent, ichild
{
private int _counter = 0;
private string _name = "None";
public string Countup () {_counter++. return GetValue ();}
public string GetValue () {return (_name + ""
+_counter. ToString ()); }
public void SetName (string key) {_name = key;}
}
}

This C # program has two classes: child and Parent


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.