我创建一个WebService这样的WSDL文件:如何生成从C#web服务
[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文件而无需连接到正在运行的服务? 我搜索了一下,并且发现了关于的信息SvcUtil.exe & wsdl.exe,但是这些仅在从运行的WebService中检索WSDL时才起作用。
(对于的Java,有一个叫的Java2WSDL工具,是有C#等效?)
:更新:
的上下文这个问题是我想将新的CustomWebService添加到应该使用WSPBuilder在SharePoint上的_vti_bin文件夹中部署的SharePoint。 另请参阅SharePoint.SE上的my post。
并且我想要(使用的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.
您正在使用.NET 2.0套牢找到?为什么要创建新的ASMX Web服务? – 2010-02-26 10:16:30
查看已更新的问题文本... – 2010-02-26 11:28:22
您必须使用ASMX服务登录页面的URL而不是程序集DLL来获取代理文件。 – vapcguy 2015-09-10 23:56:14