COM components provide web service (2) chasing wind (Visualsw)
Select the path to generate the file.
Click Next
9.
Generate files success.
Open the directory of the generated file, you can see more files:
Register IIS monitoring
1. Open IIS MMC, and create a virtual directory to point to the file address that is just generated.
2. Enter Windows CMD, enter the C: / Program Files / MSSOAP / BINARIES Enter the command c:> soapvdir.cmd update DLLSERVICES Change Command to register an ISAPI DLL to listen.
In this way, the COM component begins to provide a web service, let's test it.
Open VB, create projects, add SOAP references
Add the following code:
Dim OsoapClient
DIM NRESULT
Set OsoapClient = CreateObject ("mssoap.soapclient30")
IF (Err <> 0) THEN
MsgBox "Initialization of the Soap Toolkit Failed."
Return
END IF
Call OSoApClient.msoapinit ("http://localhost/dllservices/dllservice.wsdl", "myservice", "")
IF (Err <> 0) THEN
Msgbox "Error Initializing The WSDL File."
Return
END IF
Nresult = OSoAPClient.Add (3, 4)
MsgBox "Result of 3 4 =" & CSTR (NRESULT)
Set osoapclient = Nothing
If you can see the result, it means that the COM component is provided to provide Web Service success.
Create a component .NET proxy class
Or use the VBDLL.DLL components in the above example.
Microsoft's .NET Framework provides a tool Type Library Importer (TLBIMP.EXE) to encapsulate COM components as a .NET's Assembly, which can use encapsulated vbdll.dll in VS.NET .NET proxy Class.
1. Generate agency class
F: /sw/ms.net/web services / vb> "D: / program files / microsoft visual studio .NET / frameworksdk / bin / tlbimp.exe" vbdll.dll /out:vb_proxy.dll
Microsoft (R) .NET Framework Type Library to askses type library to askses typers 1.0.3705.0
Copyright (c) Microsoft Corporation 1998-2001. All Rights Reserved.
Type library imported to f: /sw/ms.net/web services / vb / vbdll_proxy.dll
This generates VBDLL_PROXY.DLL in the current directory,
We can see Assembly information using Intermediate Language Disassembler (ILDASM.exe),
2. Open vs.net, create a new ASP.NET Web Service
3. Add a reference to VBDLL_PROXY.DLL
4. Add a web method
[WebMethod]
Public Int Add (Int A, INT B)
{
VB_Proxy.Clsaddclass Obj = new vb_proxy.clsaddclass ();
Return Obj.Add (Short) A, (Short) b);}
5. Compile Web Service.
6. Test, the same top
Conclusion:
Both methods can realize the COM component to provide a web service, which is simple to be simpler than the second method.