I've created a WebService like this:
[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...
}
}
Is it possible to generate a WSDL file for this code without connecting to a running service? I searched and I found information about SvcUtil.exe & wsdl.exe, but these work only when retrieving the WSDL from a running WebService.
(For java, there is a tool called java2wsdl, is there a equivalent for c# ?)
:Update:
The context for this question is that I want to add new CustomWebService to SharePoint which should deployed using WSPBuilder in the _vti_bin folder on SharePoint.
See also my post on SharePoint.SE.
And I want to automatically generate (using msbuild commands) the 'MyServicewsdl.aspx' & 'MyServicedisco.wsdl' which must be placed in the _vti_bin folder.
Maybe I'm missing some things?
Output from svcutil.exe is:
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.
Create a WSDL descriptor from Java code Select the desired class name in the editor. In the main menu, go to Tools | XML WebServices and WSDL | Generate WSDL From Java Code. In the Generate WSDL From Java dialog that opens, specify the following: The name and URL address of the Web service.
To generate the WSDL file for you web service: On the Project Explorer or Navigator tab, right-click the web service class and select Web Services > Generate WSDL.
I've created a tool which can generate a WSDL file from a compiled c# assembly (dll) which contains one or more WebServices. Normally you require a running service (IIS or other) which hosts the .asmx so that you can retrieve the WSDL using /MyWebService.asmx?wsdl
This tool generate a WSDL file using reflection to retrieve all information from an assembly (dll).
Download can be found at https://github.com/StefH/WSDLGenerator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With