我创建了一个像这样的WebService:
[WebService(Namespace = "http://ns")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class GroupManagerService : WebService
{
public GroupManagerService()
{
}
[WebMethod]
public bool MyMethod(string loginname, string country)
{
// code here...
}
}
是否可以在不连接到正在运行的服务的情况下为此代码生成 WSDL 文件?
我搜索并找到了有关的信息服务管理工具 & wsdl.exe,但这些仅在从正在运行的 WebService 检索 WSDL 时才起作用。
(For java,有一个工具叫java2wsdl,是否有等价的c# ?)
:Update:
此问题的上下文是我想向 SharePoint 添加新的 CustomWebService,该服务应使用 SharePoint 上的 _vti_bin 文件夹中的 WSPBuilder 进行部署。
也可以看看my post https://sharepoint.stackexchange.com/q/1634/950在 SharePoint.SE 上。
我想自动生成(使用 msbuild 命令)'MyServicewsdl.aspx' & 'MyServicedisco.wsdl'必须放置在 _vti_bin 文件夹中。
也许我错过了一些东西?
svcutil.exe 的输出是:
bin\Debug>SvcUtil.exe MyWebService.dll
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Generating metadata files...
Warning: No metadata files were generated. No service contracts were exported.
To export a service, use the /serviceName option. To export data contracts, spe
cify the /dataContractOnly option. This can sometimes occur in certain security
contexts, such as when the assembly is loaded over a UNC network file share. If
this is the case, try copying the assembly into a trusted environment and runnin
g it.