Do not use the VS.NET integration development environment, call Microsoft's WebService registration service

zhaozj2021-02-17  110

Microsoft has opened a WebService registration service at http://210.77.155.240/regbeta2/regservice.asmx, and registered with your vs.Net Beta2, you have the opportunity to get a single foot skateboard for Generation of Microsoft.

If you integrate a development environment via the vs.Net Beta2, you can write a WebService client to call this service very simple, but I can access the configuration of the local machine of the Internet is too low, I can't install VS.NET, only one .NET Framework SDK Beta2 I have to try to call with the SDK mode. The specific implementation steps are as follows:

1. In order to call WebService, you must first generate a so-called "proxy class" locally. In order to generate this proxy class, we need to create a .cs original file, which can be implemented using the SDK tool WSDL.exe. In the command prompt, type:

WSDL /OUT: REGWEBSERVICE.CS http://210.77.155.240/REGBETA2/REGSERVICE.ASMX

Among them, RegwebService.cs is the file name of the .cs file we want to generate.

2. After you have the original file, we can generate a proxy component:

CSC /OUT: REGWEBSERVICE.DLL / T: library /r:system.xml.dll /r:System.Web.Services.dll RegwebService.cs

Generate the RegwebService.dll Agent class component library.

3. With the component library, we can write a client program that calls WebService. You can view the regwebservice.cs, based on the information of the class, write the following code:

Using system;

class RegWebServiceTest {static void Main () {RegService mRegService = new RegService (); RegType mRegType = new RegType (); mRegType.sCDKey = "cdkey"; mRegType.sName = "Name"; mRegType.sPhone = "Phone"; mRegType .sEmail = "mailto: email @ email"; mRegType.sCompany = "Company"; mRegType.sAddress = "Address"; mRegType.sCitizenID = "CitizenID"; bool IsRegSuccess = mRegService.Register (mRegType); Console.WriteLine (IsRegSuccess .Tostring ());}}

Save this code as CallWebService.cs. Confirm the input of the input fields correctly.

4. Now we can generate an executable program:

CSC /R :Regwebservice.dll CallwebService.cs

Generate CallWebService.exe.

5. Run CallWebService.exe, if returned to true, registration is successful.

转载请注明原文地址:https://www.9cbs.com/read-31523.html

New Post(0)