且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何生成WSDL出来的Web服务

更新时间:2023-09-14 11:16:58

有不适合你在找什么,可惜魔术子弹​​解决方案。这里是你可以做什么:

There isn't a magic bullet solution for what you're looking for, unfortunately. Here's what you can do:


  • 创建在Visual Studio命令提示符窗口中使用此命令的接口类:

  • create an Interface class using this command in the Visual Studio Command Prompt window:

Wsdl.exe用yourFile.wsdl / L:CS / serverInterface

使用VB或CS为您选择的语言。这将创建一个新的的.cs 的.vb 文件。

创建一个新的.NET Web服务项目。导入现有文件到您的项目 - 这是在上面的步骤中创建的文件

Create a new .NET Web Service project. Import Existing File into your project - the file that was created in the step above.

在code-查看你的 .asmx.cs 文件,修改你的类这样的:

In your .asmx.cs file in Code-View, modify your class as such:

 

 public class MyWebService : System.Web.Services.WebService, IMyWsdlInterface
 {    
     [WebMethod]
     public string GetSomeString()
     {
         //you'll have to write your own business logic 
         return "Hello SOAP World";
     }
 }